summaryrefslogtreecommitdiff
path: root/plugins/MetaContacts/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-07 12:50:40 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-07 12:50:40 +0000
commitc6fb861d7159279b6ee4a4dd678d4693ee56bac6 (patch)
treedf911e6eaf7bd944081aae96f5df9c2ef84c2476 /plugins/MetaContacts/src
parent95da57c8e9cf894adf3afae124a29d292b085c5e (diff)
death of old nasty clutch with MS_PROTO_ENUMPROTOCOLS & PROTOACCOUNT::type
git-svn-id: http://svn.miranda-ng.org/main/trunk@1799 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MetaContacts/src')
-rw-r--r--plugins/MetaContacts/src/meta_options.cpp34
-rw-r--r--plugins/MetaContacts/src/meta_services.cpp111
2 files changed, 28 insertions, 117 deletions
diff --git a/plugins/MetaContacts/src/meta_options.cpp b/plugins/MetaContacts/src/meta_options.cpp
index 9b113def92..a5394c5e84 100644
--- a/plugins/MetaContacts/src/meta_options.cpp
+++ b/plugins/MetaContacts/src/meta_options.cpp
@@ -358,12 +358,12 @@ int GetRealPriority(char *proto, int status) {
void ReadPriorities() {
int num_protocols;
- PROTOCOLDESCRIPTOR **pppDesc;
+ PROTOACCOUNT **pppDesc;
char szSetting[256];
ProtoStatusPrio * current;
int i, j;
- CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
+ ProtoEnumAccounts(&num_protocols, &pppDesc);
current = priorities = (ProtoStatusPrio *)malloc((num_protocols + 1) * sizeof(ProtoStatusPrio));
for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
@@ -374,7 +374,7 @@ void ReadPriorities() {
for (i = 0; i < num_protocols; i++) {
current = priorities + (i + 1);
for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
- mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szName, j);
+ mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szModuleName, j);
current->prio[j - ID_STATUS_OFFLINE] = DBGetContactSettingWord(0, META_PROTO, szSetting, 0xFFFF);
current->def[j - ID_STATUS_OFFLINE] = (current->prio[j - ID_STATUS_OFFLINE] == 0xFFFF);
}
@@ -383,12 +383,12 @@ void ReadPriorities() {
void WritePriorities() {
int num_protocols;
- PROTOCOLDESCRIPTOR **pppDesc;
+ PROTOACCOUNT **pppDesc;
char szSetting[256];
ProtoStatusPrio * current = priorities;
int i, j;
- CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
+ ProtoEnumAccounts(&num_protocols, &pppDesc);
for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", i);
@@ -400,7 +400,7 @@ void WritePriorities() {
for (i = 0; i < num_protocols; i++) {
current = priorities + (i + 1);
for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
- mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szName, j);
+ mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szModuleName, j);
if (!current->def[j - ID_STATUS_OFFLINE])
DBWriteContactSettingWord(0, META_PROTO, szSetting, (WORD)current->prio[j - ID_STATUS_OFFLINE]);
else
@@ -446,11 +446,11 @@ void SetPriority(int proto_index, int status, BOOL def, int prio) {
void ResetPriorities() {
int num_protocols;
- PROTOCOLDESCRIPTOR **pppDesc;
+ PROTOACCOUNT **pppDesc;
ProtoStatusPrio * current;
int i, j;
- CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
+ ProtoEnumAccounts(&num_protocols, &pppDesc);
current = priorities;
for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
@@ -479,19 +479,17 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ReadPriorities();
{
int num_protocols;
- PROTOCOLDESCRIPTOR **pppDesc;
+ PROTOACCOUNT **pppDesc;
int i, index;
- CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
+ ProtoEnumAccounts(&num_protocols, &pppDesc);
hw = GetDlgItem(hwndDlg, IDC_CMB_PROTOCOL);
index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)Translate("<default>"));
SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, -1);
for (i = 0; i < num_protocols; i++) {
- if (pppDesc[i]->type == PROTOTYPE_PROTOCOL) {
- if (strcmp(pppDesc[i]->szName, META_PROTO) != 0) {
- index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pppDesc[i]->szName);
- SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, i);
- }
+ if (strcmp(pppDesc[i]->szModuleName, META_PROTO) != 0) {
+ index = SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pppDesc[i]->szModuleName);
+ SendMessage(hw, CB_SETITEMDATA, (WPARAM)index, i);
}
}
@@ -546,10 +544,10 @@ INT_PTR CALLBACK DlgProcOptsPriorities(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
} else {
int num_protocols, caps, i;
- PROTOCOLDESCRIPTOR **pppDesc;
- CallService(MS_PROTO_ENUMPROTOCOLS, (LPARAM)&num_protocols, (WPARAM)&pppDesc);
+ PROTOACCOUNT **pppDesc;
+ ProtoEnumAccounts(&num_protocols, &pppDesc);
- caps = CallProtoService(pppDesc[index]->szName, PS_GETCAPS, PFLAGNUM_2, 0);
+ caps = CallProtoService(pppDesc[index]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
if (caps & Proto_Status2Flag(i)) {
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp
index 94aea51fc9..d4c5ea8a1b 100644
--- a/plugins/MetaContacts/src/meta_services.cpp
+++ b/plugins/MetaContacts/src/meta_services.cpp
@@ -1086,93 +1086,9 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) {
return 0;
}
-/*
-int Meta_LoadIcons(WPARAM wParam, LPARAM lParam) {
- PROTOCOLDESCRIPTOR **protos;
-
- //MessageBox(0, "LoadIcons", "Event", MB_OK);
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
- int index = 0, i;
-
- CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&proto_count,(LPARAM)&protos);
- for (i = 0; i < proto_count && i < MAX_PROTOCOLS; i++) {
- if (protos[i]->type!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0)
- continue;
-
- strncpy(proto_names + (index * 128), protos[i]->szName, 128);
- hProtoIcons[index * 2] = LoadSkinnedProtoIcon(protos[i]->szName,ID_STATUS_ONLINE);
- hProtoIcons[index * 2 + 1] = LoadSkinnedProtoIcon(protos[i]->szName,ID_STATUS_OFFLINE);
- hExtraImage[index * 2] = 0;
- hExtraImage[index * 2 + 1] = 0;
-
- //sprintf(buff, "Added icon (hIcon = %d, hImage = %d) for protocol %s.", hProtoIcons[index], hExtraImage[index], protos[i]->szName);
- //MessageBox(0, buff, "Added Extra Icon", MB_OK);
-
- index++;
- }
- proto_count = index;
-
- //Meta_CListMW_ExtraIconsRebuild(0, 0);
-
- }
-
-
- return 0;
-}
-
-int Meta_CListMW_ExtraIconsRebuild(WPARAM wParam, LPARAM lParam) {
- int i;
-
- //MessageBox(0, "IconsRebuild", "Event", MB_OK);
- Meta_LoadIcons(0, 0);
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
- for (i = 0; i < proto_count; i++) {
- hExtraImage[i * 2] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hProtoIcons[i * 2], 0);
- hExtraImage[i * 2 + 1] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hProtoIcons[i * 2 + 1], 0);
- }
- }
-
- return 0;
-}
-
-int Meta_CListMW_ExtraIconsApply(WPARAM wParam, LPARAM lParam) {
-
- //MessageBox(0, "IconsApply", "Event", MB_OK);
-
- if (DBGetContactSettingDword((HANDLE)wParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) {
- if (ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
- IconExtraColumn iec;
- HANDLE most_online_im = Meta_GetMostOnline((HANDLE)wParam);
- int i;
-
- if (most_online_im) {
- char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online_im, 0);
- if (proto) {
- WORD status = DBGetContactSettingWord(most_online_im, proto, "Status", ID_STATUS_OFFLINE);
- iec.cbSize = sizeof(iec);
- for (i = 0; i < proto_count; i++) {
- if (!strcmp((proto_names + i * 128), proto)) {
- if (hExtraImage[i * 2 + (status == ID_STATUS_OFFLINE ? 1 : 0)]) {
- iec.hImage = hExtraImage[i * 2 + (status == ID_STATUS_OFFLINE ? 1 : 0)];
- iec.ColumnType = EXTRA_ICON_ADV2;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)wParam, (LPARAM)&iec);
- iec.ColumnType = EXTRA_ICON_PROTO;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)wParam, (LPARAM)&iec);
- }
- break;
- }
- }
- }
- }
- }
- }
- return 0;
-}
-*/
-int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) {
+int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam)
+{
if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Default",(WORD)-1) == (WORD)-1)
{
// This is a simple contact
@@ -1377,23 +1293,20 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
int i, numberOfProtocols,ret;
char str[MAXMODULELABELLENGTH + 10];
HANDLE hNudgeEvent = NULL;
- PROTOCOLDESCRIPTOR ** ppProtocolDescriptors;
- ret = CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM) &numberOfProtocols,(LPARAM)&ppProtocolDescriptors);
+ PROTOACCOUNT ** ppProtocolDescriptors;
+ ret = ProtoEnumAccounts(&numberOfProtocols, &ppProtocolDescriptors);
if (ret == 0)
{
for (i = 0; i < numberOfProtocols ; i++)
{
- if (ppProtocolDescriptors[i]->type == PROTOTYPE_PROTOCOL)
- {
- if (strcmp(ppProtocolDescriptors[i]->szName, META_PROTO)) {
- sprintf(str,"%s/Nudge",ppProtocolDescriptors[i]->szName);
- hNudgeEvent = HookEvent(str, NudgeRecieved);
- if (hNudgeEvent != NULL) {
- ++iNudgeProtos;
- hNudgeEvents = (HANDLE *)realloc(hNudgeEvents, sizeof(HANDLE) * iNudgeProtos);
- hNudgeEvents[iNudgeProtos - 1] = hNudgeEvent;
- }
- }
+ if (strcmp(ppProtocolDescriptors[i]->szModuleName, META_PROTO)) {
+ sprintf(str,"%s/Nudge",ppProtocolDescriptors[i]->szModuleName);
+ hNudgeEvent = HookEvent(str, NudgeRecieved);
+ if (hNudgeEvent != NULL) {
+ ++iNudgeProtos;
+ hNudgeEvents = (HANDLE *)realloc(hNudgeEvents, sizeof(HANDLE) * iNudgeProtos);
+ hNudgeEvents[iNudgeProtos - 1] = hNudgeEvent;
+ }
}
}