diff options
Diffstat (limited to 'protocols/GTalkExt/src')
-rw-r--r-- | protocols/GTalkExt/src/GTalkExt.cpp | 3 | ||||
-rw-r--r-- | protocols/GTalkExt/src/db.h | 2 | ||||
-rw-r--r-- | protocols/GTalkExt/src/handlers.cpp | 44 | ||||
-rw-r--r-- | protocols/GTalkExt/src/options.cpp | 63 | ||||
-rw-r--r-- | protocols/GTalkExt/src/stdafx.h | 2 |
5 files changed, 65 insertions, 49 deletions
diff --git a/protocols/GTalkExt/src/GTalkExt.cpp b/protocols/GTalkExt/src/GTalkExt.cpp index 64d860f77d..85374a3883 100644 --- a/protocols/GTalkExt/src/GTalkExt.cpp +++ b/protocols/GTalkExt/src/GTalkExt.cpp @@ -32,6 +32,8 @@ int hLangpack;
HICON g_hPopupIcon = 0;
+LIST<IJabberInterface> g_accs(1, PtrKeySortT);
+
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
@@ -101,6 +103,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
+ g_accs.destroy();
InitAvaUnit(FALSE);
InitMenus(FALSE);
return 0;
diff --git a/protocols/GTalkExt/src/db.h b/protocols/GTalkExt/src/db.h index 92a01c6500..6cecd89a1d 100644 --- a/protocols/GTalkExt/src/db.h +++ b/protocols/GTalkExt/src/db.h @@ -28,6 +28,4 @@ static const LPSTR LAST_THREAD_ID_FROM_JID = SHORT_PLUGIN_NAME ".LastThreadIdFro LPTSTR ReadJidSetting(LPCSTR name, LPCTSTR jid);
void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting);
-IJabberInterface* IsGoogleAccount(LPCSTR szModuleName);
-
void RenewPseudocontactHandles();
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;
}
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 0d5fdc25ee..1f032c108e 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -233,46 +233,37 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM return 0;
}
-void AddPopupsPage(WPARAM wParam)
-{
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.ptszTitle = MAIL_NOTIFICATIONS;
- odp.pfnDlgProc = PopupsOptionsDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPSETTINGS);
- odp.hInstance = g_hInst;
- odp.ptszGroup = POPUPS_OPTIONS_GROUP;
- odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB;
- Options_AddPage(wParam, &odp);
-}
-
-void AddAccPage(LPTSTR acc, LPCSTR mod, WPARAM wParam)
-{
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.ptszTitle = acc;
- odp.pfnDlgProc = AccOptionsDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAILSETTINGS);
- odp.hInstance = g_hInst;
- odp.ptszGroup = NETWORK_OPTIONS_GROUP;
- odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
- odp.ptszTab = MAIL_NOTIFICATIONS;
- odp.dwInitParam = (LPARAM)mod;
- Options_AddPage(wParam, &odp);
-}
-
int OptionsInitialization(WPARAM wParam, LPARAM lParam)
{
- int count;
- PROTOACCOUNT **accs;
- ProtoEnumAccounts(&count, &accs);
- for (int i = 0; i < count; i++) {
- IJabberInterface *ji = IsGoogleAccount(accs[i]->szModuleName);
- if (ji)
- AddAccPage(accs[i]->tszAccountName, accs[i]->szModuleName, wParam);
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.ptszTitle = MAIL_NOTIFICATIONS;
+ odp.pfnDlgProc = PopupsOptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPSETTINGS);
+ odp.hInstance = g_hInst;
+ odp.ptszGroup = POPUPS_OPTIONS_GROUP;
+ odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB;
+ Options_AddPage(wParam, &odp);
}
- if (ServiceExists(MS_POPUP_ADDPOPUPT))
- AddPopupsPage(wParam);
- return FALSE;
+ for (int i=0; i < g_accs.getCount(); i++) {
+ LPCSTR szProto = g_accs[i]->GetModuleName();
+ PROTOACCOUNT *pa = ProtoGetAccount(szProto);
+ if (pa == 0)
+ continue;
+
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.ptszTitle = pa->tszAccountName;
+ odp.pfnDlgProc = AccOptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAILSETTINGS);
+ odp.hInstance = g_hInst;
+ odp.ptszGroup = NETWORK_OPTIONS_GROUP;
+ odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
+ odp.ptszTab = MAIL_NOTIFICATIONS;
+ odp.dwInitParam = (LPARAM)szProto;
+ Options_AddPage(wParam, &odp);
+ }
+ return 0;
}
void HookOptionsInitialization()
diff --git a/protocols/GTalkExt/src/stdafx.h b/protocols/GTalkExt/src/stdafx.h index 0a4dd456ee..c65c0ddd99 100644 --- a/protocols/GTalkExt/src/stdafx.h +++ b/protocols/GTalkExt/src/stdafx.h @@ -51,6 +51,7 @@ #pragma warning(disable:4996)
#include <m_system.h>
+#include <m_system_cpp.h>
#include <m_popup.h>
#include <m_jabber.h>
#include <m_langpack.h>
@@ -65,6 +66,7 @@ #pragma warning(pop)
extern HINSTANCE g_hInst;
+extern LIST<IJabberInterface> g_accs;
void SetAvatar(HANDLE hContact);
BOOL InitAvaUnit(BOOL init);
|