summaryrefslogtreecommitdiff
path: root/protocols/GTalkExt/src/handlers.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-28 18:22:40 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-28 18:22:40 +0000
commit56ac6b6b49cd5785ce5fb14dc63e776b4b3da07a (patch)
tree7f0b1eeaa437cf2ecd31f69add3242007f46ae3b /protocols/GTalkExt/src/handlers.cpp
parent00c6c10291bf7f86e871b648e8dd003a0a16c8e5 (diff)
- 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
Diffstat (limited to 'protocols/GTalkExt/src/handlers.cpp')
-rw-r--r--protocols/GTalkExt/src/handlers.cpp44
1 files changed, 33 insertions, 11 deletions
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");
@@ -356,6 +358,19 @@ BOOL SendHandler(IJabberInterface *ji, HXML node, void *pUserData)
}
/////////////////////////////////////////////////////////////////////////////////////////
+// adds Google extensions into the caps list
+
+int OnExtListInit(WPARAM wParam, LPARAM lParam)
+{
+ IJabberInterface *japi = (IJabberInterface*)lParam;
+ if (g_accs.indexOf(japi) != -1) {
+ LIST<TCHAR> *pList = (LIST<TCHAR>*)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;
}