1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
#include "headers.h"
HIMAGELIST himl;
void addIcons(TCHAR* szModuleFileName)
{
SKINICONDESC sid={0};
char name[32];
sid.cbSize = sizeof(sid);
sid.ptszSection = _T(modFullname);
sid.ptszDefaultFile = szModuleFileName;
sid.flags = SIDF_ALL_TCHAR;
// closed known module
sid.ptszDescription = LPGENT("Closed Known Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_KNOWN);
sid.pszName = name;
sid.iDefaultIndex = -ICO_KNOWN;
Skin_AddIcon(&sid);
// open known module
sid.ptszDescription = LPGENT("Open Known Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_KNOWNOPEN);
sid.pszName = name;
sid.iDefaultIndex = -ICO_KNOWNOPEN;
Skin_AddIcon(&sid);
// closed unknown module
sid.ptszDescription = LPGENT("Closed Unknown Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_UNKNOWN);
sid.pszName = name;
sid.iDefaultIndex = -ICO_UNKNOWN;
Skin_AddIcon(&sid);
// open unknown module
sid.ptszDescription = LPGENT("Open Unknown Module");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_UNKNOWNOPEN);
sid.pszName = name;
sid.iDefaultIndex = -ICO_UNKNOWNOPEN;
Skin_AddIcon(&sid);
// settings contact
sid.ptszDescription = LPGENT("Settings");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_SETTINGS);
sid.pszName = name;
sid.iDefaultIndex = -ICO_SETTINGS;
Skin_AddIcon(&sid);
// contact group
sid.ptszDescription = LPGENT("Contacts Group");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_CONTACTS);
sid.pszName = name;
sid.iDefaultIndex = -ICO_CONTACTS;
Skin_AddIcon(&sid);
// unknwon contact
sid.ptszDescription = LPGENT("Unknown Contact");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_OFFLINE);
sid.pszName = name;
sid.iDefaultIndex = -ICO_OFFLINE;
Skin_AddIcon(&sid);
// known contact
sid.ptszDescription = LPGENT("Known Contact");
mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_ONLINE);
sid.pszName = name;
sid.iDefaultIndex = -ICO_ONLINE;
Skin_AddIcon(&sid);
}
HICON LoadSkinnedDBEIcon(int icon)
{
char name[32];
mir_snprintf(name, SIZEOF(name), "DBE++_%d", icon);
HICON hIcon = (HICON)CallService(MS_SKIN2_GETICON,0,(LPARAM)name);
return (hIcon) ? hIcon : LoadIcon(hInst, MAKEINTRESOURCE(icon));
}
int AddIconToList(HIMAGELIST hil, HICON hIcon)
{
if (!hIcon || !hil) return 0;
ImageList_AddIcon(hil, hIcon);
return 1;
}
static PROTOCOLDESCRIPTOR **protocols = NULL;
static int protoCount = 0;
static int shift = 0;
void AddProtoIconsToList(HIMAGELIST hil, int newshift)
{
HICON hIcon;
int i;
shift = newshift;
CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&protoCount,(LPARAM)&protocols);
for(i = 0 ;i < protoCount; i++)
{
if (protocols[i]->type != PROTOTYPE_PROTOCOL)
continue;
if (hIcon=LoadSkinnedProtoIcon(protocols[i]->szName, ID_STATUS_ONLINE))
AddIconToList(hil, hIcon);
else
AddIconToList(himl, LoadSkinnedDBEIcon(ICO_ONLINE));
}
}
int GetProtoIcon(char *szProto)
{
int result = DEF_ICON;
int i, n = 0;
if (!protoCount || !protocols || !szProto) return result;
for(i = 0 ;i < protoCount; i++)
{
if (protocols[i]->type != PROTOTYPE_PROTOCOL)
continue;
if (!mir_strcmp(protocols[i]->szName, szProto))
{
result = n + shift;
break;
}
n++;
}
return result;
}
BOOL IsProtocolLoaded(char* pszProtocolName)
{
/*
if (pszProtocolName && pszProtocolName[0])
{
int res = CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pszProtocolName);
if (res != CALLSERVICE_NOTFOUND && res)
return TRUE;
}
*/
int i;
if (protoCount)
for(i = 0 ;i < protoCount; i++)
{
if (protocols[i]->type != PROTOTYPE_PROTOCOL)
continue;
if (!mir_strcmp(protocols[i]->szName, pszProtocolName))
return TRUE;
}
return FALSE;
}
|