summaryrefslogtreecommitdiff
path: root/protocols/GTalkExt/src/handlers.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-26 20:54:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-26 20:54:17 +0000
commit315ffb3628684434969b1f740860036a280dddfc (patch)
tree06519021523088cc7db59b1e0f20a52cfdddbb51 /protocols/GTalkExt/src/handlers.cpp
parent474dc76177b2f518f24a0800d62df97171da7c9a (diff)
Google account autodetect
git-svn-id: http://svn.miranda-ng.org/main/trunk@4208 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/GTalkExt/src/handlers.cpp')
-rw-r--r--protocols/GTalkExt/src/handlers.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp
index 83e4c036ad..157c890205 100644
--- a/protocols/GTalkExt/src/handlers.cpp
+++ b/protocols/GTalkExt/src/handlers.cpp
@@ -403,12 +403,31 @@ BOOL SendHandler(IJabberInterface *ji, HXML node, void *pUserData)
}
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+IJabberInterface* IsGoogleAccount(LPCSTR szModuleName)
+{
+ IJabberInterface *japi = getJabberApi(szModuleName);
+ if (!japi) return NULL;
+
+ DBVARIANT dbv;
+ if ( DBGetContactSettingString(NULL, szModuleName, "ManualHost", &dbv))
+ return NULL;
+
+ __try {
+ return (!strcmp(dbv.pszVal, "talk.google.com")) ? japi : NULL;
+ }
+ __finally {
+ db_free(&dbv);
+ }
+}
+
int AccListChanged(WPARAM wParam, LPARAM lParam)
{
- if (PRAC_ADDED == wParam) {
- IJabberInterface *japi = getJabberApi(((PROTOACCOUNT*)lParam)->szModuleName);
- if (japi)
- japi->Net()->AddSendHandler(SendHandler);
+ if (wParam == PRAC_ADDED) {
+ IJabberInterface *ji = IsGoogleAccount(((PROTOACCOUNT*)lParam)->szModuleName);
+ if (ji)
+ ji->Net()->AddSendHandler(SendHandler);
}
return 0;
}
@@ -418,10 +437,10 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
int count;
PROTOACCOUNT **protos;
ProtoEnumAccounts(&count, &protos);
- for (int i = 0; i < count; i++) {
- IJabberInterface *japi = getJabberApi(protos[i]->szModuleName);
- if (japi)
- japi->Net()->AddSendHandler(SendHandler);
+ for (int i=0; i < count; i++) {
+ IJabberInterface *ji = IsGoogleAccount(protos[i]->szModuleName);
+ if (ji)
+ ji->Net()->AddSendHandler(SendHandler);
}
HookEvent(ME_JABBER_MENUINIT, InitMenus);