source: titan/plugins/panel/panel_feed.h @ 12126

Last change on this file since 12126 was 12126, checked in by nit, 12 years ago

[titan] panel add feed input

File size: 883 bytes
Line 
1#ifndef PANEL_FEED_H
2#define PANEL_FEED_H
3
4void screenpanel_feed()
5{
6        char* tmpstr = NULL, *line1 = NULL, *line2 = NULL;
7
8        line2 = readsys(getconfig("feed", NULL), 2);
9        line2 =  string_replace("src/gz secret http://", "", line2, 1);
10        line2 = textinput("Feed", line2);
11       
12        if(line2 != NULL)
13        {
14                line1 = readsys(getconfig("feed", NULL), 1);
15                if(line1 == NULL) line1 = ostrcat("#", NULL, 0, 0);
16
17                if(line1[strlen(line1) - 1] == '\n')
18                        tmpstr = ostrcat(line1, "src/gz secret http://", 0, 0);
19                else
20                        tmpstr = ostrcat(line1, "\nsrc/gz secret http://", 0, 0);
21
22                if(tmpstr != NULL && tmpstr[0] == '\n')
23                        tmpstr = ostrcat("#", tmpstr, 0, 1);
24               
25                if(strlen(line2) == 0)
26                {
27                        free(tmpstr);
28                        tmpstr = ostrcat(line1, NULL, 0, 0);
29                }
30
31                tmpstr = ostrcat(tmpstr, line2, 1, 0);
32                writesys(getconfig("feed", NULL), tmpstr, 0);
33        }
34
35        free(tmpstr);
36        free(line1);
37        free(line2);
38}
39
40#endif
Note: See TracBrowser for help on using the repository browser.