From 56ac6b6b49cd5785ce5fb14dc63e776b4b3da07a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 28 Sep 2013 18:22:40 +0000 Subject: - Google specific functionality got moved to GTalkExt, part I; - new event for extensions list creation, ME_JABBER_EXTLISTINIT git-svn-id: http://svn.miranda-ng.org/main/trunk@6260 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/GTalkExt/src/handlers.cpp | 44 +++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'protocols/GTalkExt/src/handlers.cpp') diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index f5bd3bc212..a08c68c21a 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -26,6 +26,8 @@ #include "notifications.h" #include "options.h" +#define JABBER_EXT_GTALK_PMUC _T("pmuc-v1") + static const LPCTSTR JABBER_IQID = _T("mir_"); static const LPCTSTR JABBER_IQID_FORMAT = _T("mir_%d"); @@ -355,6 +357,19 @@ BOOL SendHandler(IJabberInterface *ji, HXML node, void *pUserData) return FALSE; } +///////////////////////////////////////////////////////////////////////////////////////// +// adds Google extensions into the caps list + +int OnExtListInit(WPARAM wParam, LPARAM lParam) +{ + IJabberInterface *japi = (IJabberInterface*)lParam; + if (g_accs.indexOf(japi) != -1) { + LIST *pList = (LIST*)wParam; + pList->insert(JABBER_EXT_GTALK_PMUC); + } + return 0; +} + ///////////////////////////////////////////////////////////////////////////////////////// // for our pseudo contact only our own popups are allowed // 0 = allowed, 1 = disallowed @@ -370,6 +385,20 @@ int OnFilterPopup(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// +int AccListChanged(WPARAM wParam, LPARAM lParam) +{ + if (wParam == PRAC_ADDED) { + IJabberInterface *ji = getJabberApi(((PROTOACCOUNT*)lParam)->szModuleName); + if (ji) { + g_accs.insert(ji); + ji->AddSendHandler(SendHandler); + } + } + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + IJabberInterface* IsGoogleAccount(LPCSTR szModuleName) { IJabberInterface *japi = getJabberApi(szModuleName); @@ -383,16 +412,6 @@ IJabberInterface* IsGoogleAccount(LPCSTR szModuleName) return ( !strcmp(host, "talk.google.com")) ? japi : NULL; } -int AccListChanged(WPARAM wParam, LPARAM lParam) -{ - if (wParam == PRAC_ADDED) { - IJabberInterface *ji = getJabberApi(((PROTOACCOUNT*)lParam)->szModuleName); - if (ji) - ji->AddSendHandler(SendHandler); - } - return 0; -} - int ModulesLoaded(WPARAM wParam, LPARAM lParam) { RenewPseudocontactHandles(); @@ -402,11 +421,14 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) ProtoEnumAccounts(&count, &protos); for (int i=0; i < count; i++) { IJabberInterface *ji = IsGoogleAccount(protos[i]->szModuleName); - if (ji) + if (ji) { + g_accs.insert(ji); ji->AddSendHandler(SendHandler); + } } HookEvent(ME_POPUP_FILTER, OnFilterPopup); + HookEvent(ME_JABBER_EXTLISTINIT, OnExtListInit); HookOptionsInitialization(); return 0; } -- cgit v1.2.3