source: titan/titan/httpdsettings.h @ 27981

Last change on this file since 27981 was 27887, checked in by obi, 10 years ago

add streamzapping

File size: 4.0 KB
Line 
1#ifndef HTTDPSETTINGS_H
2#define HTTPDSETTINGS_H
3
4void screenhttpdsettings()
5{
6        int rcret = 0;
7        struct skin* httpdsettings = getscreen("httpdsettings");
8        struct skin* listbox = getscreennode(httpdsettings, "listbox");
9        struct skin* httpdstart = getscreennode(httpdsettings, "httpdstart");
10        struct skin* user = getscreennode(httpdsettings, "user");
11        struct skin* password = getscreennode(httpdsettings, "password");
12        struct skin* httpdport = getscreennode(httpdsettings, "httpdport");
13        struct skin* streamport = getscreennode(httpdsettings, "streamport");
14        struct skin* rguidstart = getscreennode(httpdsettings, "rguidstart");
15        struct skin* rguidport = getscreennode(httpdsettings, "rguidport");
16        struct skin* webifip = getscreennode(httpdsettings, "webifip");
17        struct skin* streamzapping = getscreennode(httpdsettings, "streamzapping");
18
19        struct skin* tmp = NULL;
20        char* tmpstr = NULL, *pos = NULL;
21
22        addchoicebox(httpdstart, "0", _("no"));
23        addchoicebox(httpdstart, "1", _("yes"));
24        setchoiceboxselection(httpdstart, getconfig("httpdstart", NULL));
25
26        tmpstr = ostrcat(getconfig("httpauth", NULL), NULL, 0, 0);
27        if(tmpstr != NULL)
28        {
29                pos = ostrstr(tmpstr, ":");
30                if(pos != NULL)
31                {
32                        pos[0] = '\0';
33                        changeinput(user, tmpstr);
34                        pos++;
35                        changeinput(password, pos);
36                }
37        }
38        free(tmpstr); tmpstr = NULL;
39
40        changemask(httpdport, "00000");
41        changeinput(httpdport, getconfig("httpdport", NULL));
42        httpdport->input = mask(httpdport->input, 5, "0");
43
44        addchoicebox(webifip, "0", _("intern"));
45        addchoicebox(webifip, "1", _("extern"));
46        setchoiceboxselection(webifip, getconfig("webifip", NULL));
47
48        changemask(streamport, "00000");
49        changeinput(streamport, getconfig("streamport", NULL));
50        streamport->input = mask(streamport->input, 5, "0");
51       
52        addchoicebox(rguidstart, "0", _("no"));
53        addchoicebox(rguidstart, "1", _("yes"));
54        setchoiceboxselection(rguidstart, getconfig("rguidstart", NULL));
55
56        changemask(rguidport, "00000");
57        changeinput(rguidport, getconfig("rguidport", NULL));
58        rguidport->input = mask(rguidport->input, 5, "0");
59
60        addchoicebox(streamzapping, "0", _("no"));
61        addchoicebox(streamzapping, "1", _("yes"));
62        setchoiceboxselection(streamzapping, getconfig("streamzapping", NULL));
63
64        drawscreen(httpdsettings, 0, 0);
65        addscreenrc(httpdsettings, listbox);
66
67        tmp = listbox->select;
68        while(1)
69        {
70                addscreenrc(httpdsettings, tmp);
71                rcret = waitrc(httpdsettings, 0, 0);
72                tmp = listbox->select;
73
74                if(rcret == getrcconfigint("rcexit", NULL)) break;
75                if(rcret == getrcconfigint("rcok", NULL))
76                {
77                        if(httpdstart->ret != NULL)
78                        {
79                                if(ostrcmp(getconfig("httpdstart", NULL), httpdstart->ret) != 0)
80                                {
81                                        addconfigscreen("httpdstart", httpdstart);
82                                        if(ostrcmp(httpdstart->ret, "0") == 0)
83                                                starthttpd(0);
84                                        else
85                                                starthttpd(1);
86                                }
87                        }
88                        if(user->ret != NULL && password->ret != NULL && strlen(user->ret) > 0 && strlen(password->ret) > 0)
89                        {
90                                tmpstr = ostrcat(tmpstr, user->ret, 1, 0);
91                                tmpstr = ostrcat(tmpstr, ":", 1, 0);
92                                tmpstr = ostrcat(tmpstr, password->ret, 1, 0);
93                                addconfig("httpauth", tmpstr);
94                                free(tmpstr); tmpstr = NULL;
95                        }
96                        else
97                                delconfig("httpauth");
98                        free(status.httpauth);
99                        status.httpauth = ostrcat(getconfig("httpauth", NULL), NULL, 0, 0);
100                        if(httpdport->ret != NULL)
101                        {
102                                int hport = atoi(httpdport->ret);
103                                addconfigint("httpdport", hport);
104                        }
105
106                        addconfigscreencheck("webifip", webifip, "0");
107                        addconfigscreencheck("streamzapping", streamzapping, "0");
108
109                        if(streamport->ret != NULL)
110                        {
111                                int sport = atoi(streamport->ret);
112                                addconfigint("streamport", sport);
113                        }
114                        if(rguidstart->ret != NULL)
115                        {
116                                if(ostrcmp(getconfig("rguidstart", NULL), rguidstart->ret) != 0)
117                                {
118                                        addconfigscreen("rguidstart", rguidstart);
119                                        if(ostrcmp(rguidstart->ret, "0") == 0)
120                                                startrguid(0);
121                                        else
122                                                startrguid(1);
123                                }
124                        }
125                        if(rguidport->ret != NULL)
126                        {
127                                int rport = atoi(rguidport->ret);
128                                addconfigint("rguidport", rport);
129                        }
130                        break;
131                }
132        }
133
134        delownerrc(httpdsettings);
135        clearscreen(httpdsettings);
136}
137
138#endif
Note: See TracBrowser for help on using the repository browser.