From 31b191bc8ddb639e488ab8306f71ac1dbabf16f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 3 Nov 2012 17:32:37 +0000 Subject: removing built-in Clist Modern extra icons part I git-svn-id: http://svn.miranda-ng.org/main/trunk@2167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MetaContacts/src/meta_services.cpp | 423 ++++++----------------------- plugins/MetaContacts/src/metacontacts.h | 1 - 2 files changed, 88 insertions(+), 336 deletions(-) (limited to 'plugins/MetaContacts/src') diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index 26609d23be..9379b39f8d 100644 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -27,9 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "metacontacts.h" -#define NB_SERVICES 62 //!< Number of services registered in Miranda (see Meta_CloseHandles()). -#define NB_HOOKS 17 //!< Number of hooks set up (see Meta_CloseHandles()). - #define PREF_METANODB 0x2000 //!< Flag to indicate message should not be added to db by filter when sending char *pendingACK = 0; //!< Name of the protocol in which an ACK is about to come. @@ -37,12 +34,6 @@ char *pendingACK = 0; //!< Name of the protocol in which an ACK is about to com int previousMode, //!< Previous status of the MetaContacts Protocol mcStatus; //!< Current status of the MetaContacts Protocol -HANDLE hServices[NB_SERVICES] = {0}, //!< list of all the services registered (see Meta_CloseHandles()). -hHooks[NB_HOOKS] = {0}; //!< list of all hooks set up (see Meta_CloseHandles()). - -HANDLE *hNudgeEvents = 0; -int iNudgeProtos = 0; - HGENMENU hMenuConvert, //!< \c HANDLE to the convert menu item. hMenuAdd, //!< \c HANDLE to the add to menu item. @@ -65,7 +56,6 @@ DWORD nextMetaID; //!< Global variable specifying the ID value the next MetaCont BOOL message_window_api_enabled = FALSE; //!< Global variable specifying whether the message window api ver 0.0.0.1+ is available // stuff for mw_clist extra icon -int proto_count = 0; HANDLE hExtraImage[MAX_PROTOCOLS * 2]; // online and offline icons char proto_names[MAX_PROTOCOLS * 128]; HANDLE hProtoIcons[MAX_PROTOCOLS * 2]; // online and offline icons @@ -1167,7 +1157,6 @@ int NudgeRecieved(WPARAM wParam, LPARAM lParam) { */ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) { - CLISTMENUITEM mi = {0}; char buffer[512], buffer2[512], buffer3[512]; int i; @@ -1185,16 +1174,11 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists("DBEditorpp/RegisterSingleModule")) CallService("DBEditorpp/RegisterSingleModule",(WPARAM)META_PROTO,0); - hHooks[11] = (HANDLE)HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Meta_ModifyMenu); - hHooks[12] = (HANDLE)HookEvent(ME_CLIST_DOUBLECLICKED, Meta_ClistDoubleClicked ); - //hHooks[13] = (HANDLE)HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, Meta_CListMW_ExtraIconsRebuild); - //hHooks[14] = (HANDLE)HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, Meta_CListMW_ExtraIconsApply); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Meta_ModifyMenu); + HookEvent(ME_CLIST_DOUBLECLICKED, Meta_ClistDoubleClicked ); - // icons are erased on this event... - // (BUT, the me_clist_extra_list_rebuild is send FIRST...so, we ignore this one...) - hHooks[15] = 0;//(HANDLE)HookEvent(ME_SKIN_ICONSCHANGED, Meta_LoadIcons); - - mi.cbSize = sizeof(mi); + //////////////////////////////////////////////////////////////////////////// + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ALL; // main menu item @@ -1284,8 +1268,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) } // hook srmm window close/open events - message api ver 0.0.0.1+ - hHooks[16] = (HANDLE)HookEvent(ME_MSG_WINDOWEVENT, Meta_MessageWindowEvent); - if (hHooks[16]) // message api available + if (HookEvent(ME_MSG_WINDOWEVENT, Meta_MessageWindowEvent)) message_window_api_enabled = TRUE; // hook protocol nudge events to forward to subcontacts @@ -1301,15 +1284,9 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) { 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; - } + HookEvent(str, NudgeRecieved); } } - } } return 0; @@ -1378,192 +1355,6 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { //////////////////// // file transfer support - mostly not required, since subcontacts do the receiving //////////////////// -/* -INT_PTR Meta_FileResume(WPARAM wParam, LPARAM lParam) -{ - DBVARIANT dbv; - CCSDATA *ccs = (CCSDATA *) lParam; - char *proto = 0; - - if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv)) - { - // This is a simple contact - // (this should normally not happen, since linked contacts do not appear on the list.) - return 1; - } - else - { - HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILERESUME); - //DBEVENTINFO dbei; - char szServiceName[100]; - - DBFreeVariant(&dbv); - - if (!most_online) - return 0; - - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); - - ccs->hContact = most_online; - Meta_SetNick(proto); - - _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PS_FILERESUME); - if (ServiceExists(szServiceName)) { - strncpy(szServiceName, PS_FILERESUME, sizeof(szServiceName)); - return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam)); - } - } - return 1; // fail -} - -INT_PTR Meta_FileAllow(WPARAM wParam, LPARAM lParam) -{ - DBVARIANT dbv; - CCSDATA *ccs = (CCSDATA *) lParam; - char *proto = 0; - - if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv)) - { - // This is a simple contact - // (this should normally not happen, since linked contacts do not appear on the list.) - return 0; - } - else - { - HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE); - char szServiceName[100]; - - DBFreeVariant(&dbv); - - if (!most_online) - return 0; - - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); - - ccs->hContact = most_online; - Meta_SetNick(proto); - - _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILEALLOW); - if (ServiceExists(szServiceName)) { - strncpy(szServiceName, PSS_FILEALLOW, sizeof(szServiceName)); - return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam)); - } - } - return 0; // fail -} - -INT_PTR Meta_FileDeny(WPARAM wParam, LPARAM lParam) -{ - DBVARIANT dbv; - CCSDATA *ccs = (CCSDATA *) lParam; - char *proto = 0; - - if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv)) - { - // This is a simple contact - // (this should normally not happen, since linked contacts do not appear on the list.) - return 1; - } - else - { - HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE); - //DBEVENTINFO dbei; - char szServiceName[100]; - - DBFreeVariant(&dbv); - - if (!most_online) - return 1; - - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); - - ccs->hContact = most_online; - Meta_SetNick(proto); - - _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILEDENY); - if (ServiceExists(szServiceName)) { - strncpy(szServiceName, PSS_FILEDENY, sizeof(szServiceName)); - return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam)); - } - } - return 1; // fail -} - -INT_PTR Meta_FileRecv(WPARAM wParam, LPARAM lParam) -{ - DBVARIANT dbv; - CCSDATA *ccs = (CCSDATA *) lParam; - char *proto = 0; - - if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv)) - { - // This is a simple contact - // (this should normally not happen, since linked contacts do not appear on the list.) - return 0; - } - else - { - HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE); - //DBEVENTINFO dbei; - char szServiceName[100]; - - DBFreeVariant(&dbv); - - if (!most_online) - return 0; - - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); - - ccs->hContact = most_online; - Meta_SetNick(proto); - - _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSR_FILE); - if (ServiceExists(szServiceName)) { - strncpy(szServiceName, PSR_FILE, sizeof(szServiceName)); - return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam)); - } - } - - return 0; -} - -int Meta_FileCancel(WPARAM wParam, LPARAM lParam) -{ - DBVARIANT dbv; - CCSDATA *ccs = (CCSDATA *) lParam; - char *proto = 0; - - if (DBGetContactSetting(ccs->hContact,META_PROTO,"Default",&dbv)) - { - // This is a simple contact - // (this should normally not happen, since linked contacts do not appear on the list.) - return 0; - } - else - { - HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILE); - //DBEVENTINFO dbei; - char szServiceName[100]; - - DBFreeVariant(&dbv); - - if (!most_online) - return 0; - - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); - - ccs->hContact = most_online; - Meta_SetNick(proto); - - _snprintf(szServiceName, sizeof(szServiceName), "%s%s", proto, PSS_FILECANCEL); - if (ServiceExists(szServiceName)) { - strncpy(szServiceName, PSS_FILECANCEL, sizeof(szServiceName)); - return (int)(CallContactService(ccs->hContact, szServiceName, ccs->wParam, ccs->lParam)); - } - } - return 0; -} -*/ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam) { @@ -1828,103 +1619,89 @@ int Meta_OnIdleChanged(WPARAM wParam, LPARAM lParam) { */ void Meta_InitServices() { - int i; - previousMode = mcStatus = ID_STATUS_OFFLINE; - // set hooks pointers and services pointers to zero - in case we do not initialize them all correctly - for (i=0;i