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

Last change on this file since 15602 was 15602, checked in by obi, 12 years ago

fix feed

File size: 1.6 KB
Line 
1#ifndef PANEL_FEED_H
2#define PANEL_FEED_H
3
4void screenpanel_feed()
5{
6        char* tmpstr = NULL, *line = NULL, *lastline = NULL;
7        char* pos = NULL;
8
9        tmpstr = readsys(getconfig("feed", NULL), 3); //line3
10        tmpstr = string_replace("src/gz secret http://", "", tmpstr, 1);
11       
12        if(tmpstr != NULL)
13                pos = strchr(tmpstr, '/');
14        if(pos != NULL)
15                pos[0] = '\0';
16
17        if(tmpstr == NULL || ostrcmp(tmpstr, "") == 0 || ostrcmp(tmpstr, "\n") == 0)
18                tmpstr = ostrcat(tmpstr, "000.000.000.000", 1, 0);
19               
20        lastline = numinput(_("Feed"), tmpstr, "000.000.000.000", 1);
21       
22        if(lastline != NULL)
23        {
24                free(tmpstr); tmpstr = NULL;
25                tmpstr = fixip(lastline, 1);
26                free(lastline); lastline = tmpstr;
27
28                tmpstr = readsys(getconfig("feed", NULL), 1); //line1
29                if(tmpstr == NULL || (tmpstr != NULL && strlen(tmpstr) == 0))
30                        line = ostrcat(line, "#", 1, 0);
31                else
32                        line = ostrcat(line, tmpstr, 1, 0);
33                free(tmpstr); tmpstr = NULL;
34
35                if(line[strlen(line) - 1] != '\n')
36                        line = ostrcat(line, "\n", 1, 0);
37               
38                tmpstr = readsys(getconfig("feed", NULL), 2); //line2
39                if(tmpstr == NULL || (tmpstr != NULL && strlen(tmpstr) == 0))
40                        line = ostrcat(line, "#\n", 1, 0);
41                else
42                        line = ostrcat(line, tmpstr, 1, 0);
43                free(tmpstr); tmpstr = NULL;
44
45                if(line[strlen(line) - 1] == '\n')
46                        tmpstr = ostrcat(line, "src/gz secret http://", 0, 0);
47                else
48                        tmpstr = ostrcat(line, "\nsrc/gz secret http://", 0, 0);
49               
50                if(strlen(lastline) == 0)
51                {
52                        free(tmpstr);
53                        tmpstr = ostrcat(line, NULL, 0, 0);
54                }
55
56                tmpstr = ostrcat(tmpstr, lastline, 1, 0);
57                tmpstr = ostrcat(tmpstr, "/svn/ipk/sh4/titan", 1, 0);
58                writesys(getconfig("feed", NULL), tmpstr, 0);
59        }
60
61        free(tmpstr);
62        free(line);
63        free(lastline);
64}
65
66#endif
Note: See TracBrowser for help on using the repository browser.