1 | #ifndef CHANNELHISTORY_H |
---|
2 | #define CHANNELHISTORY_H |
---|
3 | |
---|
4 | void freechannelhistory() |
---|
5 | { |
---|
6 | int i = 0; |
---|
7 | |
---|
8 | for(i = 0; i < MAXCHANNELHISTORY; i++) |
---|
9 | { |
---|
10 | channelhistory[i].chnode = NULL; |
---|
11 | free(channelhistory[i].channellist); |
---|
12 | channelhistory[i].channellist = NULL; |
---|
13 | } |
---|
14 | } |
---|
15 | |
---|
16 | void delchannelhistory(struct channel* chnode) |
---|
17 | { |
---|
18 | int i = 0; |
---|
19 | if(chnode == NULL) return; |
---|
20 | |
---|
21 | for(i = 0; i < MAXCHANNELHISTORY; i++) |
---|
22 | { |
---|
23 | if(channelhistory[i].chnode == chnode) |
---|
24 | { |
---|
25 | channelhistory[i].chnode = NULL; |
---|
26 | free(channelhistory[i].channellist); |
---|
27 | channelhistory[i].channellist = NULL; |
---|
28 | } |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | void addchannelhistory(struct channel* chnode, char* channellist) |
---|
33 | { |
---|
34 | int i = 0, treffer = 0; |
---|
35 | if(chnode == NULL || channellist == NULL) return; |
---|
36 | |
---|
37 | for(i = 0; i < MAXCHANNELHISTORY - 1; i++) |
---|
38 | { |
---|
39 | if(channelhistory[i].chnode == chnode) |
---|
40 | treffer = 1; |
---|
41 | } |
---|
42 | |
---|
43 | if(treffer == 1) return; |
---|
44 | |
---|
45 | for(i = MAXCHANNELHISTORY - 1; i > 0 ; i--) |
---|
46 | { |
---|
47 | channelhistory[i].chnode = channelhistory[i - 1].chnode; |
---|
48 | channelhistory[i].channellist = channelhistory[i - 1].channellist; |
---|
49 | } |
---|
50 | |
---|
51 | channelhistory[0].chnode = chnode; |
---|
52 | channelhistory[0].channellist = ostrcat(channellist, NULL, 0, 0); |
---|
53 | } |
---|
54 | |
---|
55 | void screenchannelhistory() |
---|
56 | { |
---|
57 | int rcret = -1, i = 0; |
---|
58 | struct skin* chistory = getscreen("channelhistory"); |
---|
59 | struct skin* listbox = getscreennode(chistory, "listbox"); |
---|
60 | struct skin* tmp = NULL; |
---|
61 | |
---|
62 | listbox->aktline = 1; |
---|
63 | listbox->aktpage = -1; |
---|
64 | |
---|
65 | for(i = 1; i < MAXCHANNELHISTORY; i++) |
---|
66 | { |
---|
67 | if(channelhistory[i].chnode != NULL && channelhistory[i].channellist != NULL) |
---|
68 | { |
---|
69 | tmp = addlistbox(chistory, listbox, tmp, 1); |
---|
70 | if(tmp != NULL) |
---|
71 | { |
---|
72 | changetext(tmp, channelhistory[i].chnode->name); |
---|
73 | tmp->handle = (char*)channelhistory[i].chnode; |
---|
74 | tmp->handle1 = channelhistory[i].channellist; |
---|
75 | } |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | addscreenrc(chistory, listbox); |
---|
80 | drawscreen(chistory, 0); |
---|
81 | |
---|
82 | while(1) |
---|
83 | { |
---|
84 | rcret = waitrc(chistory, 0, 0); |
---|
85 | |
---|
86 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
87 | if(rcret == getrcconfigint("rcok", NULL)) |
---|
88 | { |
---|
89 | if(listbox->select != NULL && listbox->select->handle != NULL && listbox->select->handle1 != NULL) |
---|
90 | servicecheckret(servicestart((struct channel*)listbox->select->handle, listbox->select->handle1, NULL, 0), 0); |
---|
91 | |
---|
92 | break; |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | delmarkedscreennodes(chistory, 1); |
---|
97 | delownerrc(chistory); |
---|
98 | clearscreen(chistory); |
---|
99 | drawscreen(skin, 0); |
---|
100 | } |
---|
101 | |
---|
102 | #endif |
---|