summaryrefslogtreecommitdiff
path: root/protocols/GTalkExt/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/GTalkExt/src')
-rw-r--r--protocols/GTalkExt/src/GTalkExt.cpp6
-rw-r--r--protocols/GTalkExt/src/Version.h4
-rw-r--r--protocols/GTalkExt/src/db.cpp18
-rw-r--r--protocols/GTalkExt/src/db.h2
-rw-r--r--protocols/GTalkExt/src/handlers.cpp7
-rw-r--r--protocols/GTalkExt/src/handlers.h2
-rw-r--r--protocols/GTalkExt/src/inbox.cpp19
-rw-r--r--protocols/GTalkExt/src/inbox.h4
-rw-r--r--protocols/GTalkExt/src/menu.cpp72
-rw-r--r--protocols/GTalkExt/src/notifications.cpp111
-rw-r--r--protocols/GTalkExt/src/notifications.h1
-rw-r--r--protocols/GTalkExt/src/options.cpp25
-rw-r--r--protocols/GTalkExt/src/options.h2
-rw-r--r--protocols/GTalkExt/src/resources.h3
-rw-r--r--protocols/GTalkExt/src/stdafx.h3
15 files changed, 242 insertions, 37 deletions
diff --git a/protocols/GTalkExt/src/GTalkExt.cpp b/protocols/GTalkExt/src/GTalkExt.cpp
index 845c990d71..64d860f77d 100644
--- a/protocols/GTalkExt/src/GTalkExt.cpp
+++ b/protocols/GTalkExt/src/GTalkExt.cpp
@@ -27,6 +27,7 @@
#include "handlers.h"
#include "tipper_items.h"
#include "Version.h"
+#include "inbox.h"
int hLangpack;
HICON g_hPopupIcon = 0;
@@ -86,6 +87,9 @@ extern "C" int __declspec(dllexport) Load(void)
g_hPopupIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_POPUP));
+ InitAvaUnit(TRUE);
+ InitMenus(TRUE);
+
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged);
@@ -97,5 +101,7 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
+ InitAvaUnit(FALSE);
+ InitMenus(FALSE);
return 0;
}
diff --git a/protocols/GTalkExt/src/Version.h b/protocols/GTalkExt/src/Version.h
index 24c00cd0fd..bed7bb9a3f 100644
--- a/protocols/GTalkExt/src/Version.h
+++ b/protocols/GTalkExt/src/Version.h
@@ -1,6 +1,6 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 1
+#define __MINOR_VERSION 1
+#define __RELEASE_NUM 0
#define __BUILD_NUM 1
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
diff --git a/protocols/GTalkExt/src/db.cpp b/protocols/GTalkExt/src/db.cpp
index 691e065bc3..a652babe49 100644
--- a/protocols/GTalkExt/src/db.cpp
+++ b/protocols/GTalkExt/src/db.cpp
@@ -31,3 +31,21 @@ void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting)
{
db_set_ts(0, name, _T2A(jid), setting);
}
+
+void RenewPseudocontactHandles()
+{
+ int count = 0;
+ PROTOACCOUNT **protos;
+ ProtoEnumAccounts(&count, &protos);
+ for (int i = 0; i < count; i++) {
+ db_unset(0, protos[i]->szModuleName, PSEUDOCONTACT_LINK);
+ db_unset(0, protos[i]->szModuleName, "GMailExtNotifyContact"); // remove this
+ }
+
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ if (db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
+ LPCSTR proto = (LPCSTR)GetContactProto(hContact);
+ db_set_dw(NULL, proto, PSEUDOCONTACT_LINK, (DWORD)hContact);
+ }
+ }
+}
diff --git a/protocols/GTalkExt/src/db.h b/protocols/GTalkExt/src/db.h
index 2a688dcad0..92a01c6500 100644
--- a/protocols/GTalkExt/src/db.h
+++ b/protocols/GTalkExt/src/db.h
@@ -29,3 +29,5 @@ 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 91974a914b..9f8ff03aff 100644
--- a/protocols/GTalkExt/src/handlers.cpp
+++ b/protocols/GTalkExt/src/handlers.cpp
@@ -134,8 +134,10 @@ BOOL InternalListHandler(IJabberInterface *ji, HXML node, LPCTSTR jid, LPCTSTR m
if (!acc)
return FALSE;
- if (!unreadCount)
+ if (!unreadCount) {
+ SetupPseudocontact(jid, xi.getAttrValue(node, ATTRNAME_TOTAL_MATCHED), acc);
return TRUE;
+ }
DWORD settings = ReadNotificationSettings(acc);
@@ -380,6 +382,8 @@ int AccListChanged(WPARAM wParam, LPARAM lParam)
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
+ RenewPseudocontactHandles();
+
int count;
PROTOACCOUNT **protos;
ProtoEnumAccounts(&count, &protos);
@@ -389,7 +393,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
ji->Net()->AddSendHandler(SendHandler);
}
- HookEvent(ME_JABBER_MENUINIT, InitMenus);
HookOptionsInitialization();
return 0;
}
diff --git a/protocols/GTalkExt/src/handlers.h b/protocols/GTalkExt/src/handlers.h
index 10ffa8cb81..c9d7dd120d 100644
--- a/protocols/GTalkExt/src/handlers.h
+++ b/protocols/GTalkExt/src/handlers.h
@@ -24,4 +24,4 @@
extern HANDLE hModulesLoaded;
int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-int AccListChanged(WPARAM wParam, LPARAM lParam); \ No newline at end of file
+int AccListChanged(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp
index 471431a185..4343ae6fe2 100644
--- a/protocols/GTalkExt/src/inbox.cpp
+++ b/protocols/GTalkExt/src/inbox.cpp
@@ -66,8 +66,7 @@ const DWORD SIZE_OF_JABBER_OPTIONS = 243 * sizeof(DWORD);
LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams)
{
- NETLIBHTTPREQUEST nlhr = {0};
- nlhr.cbSize = sizeof(nlhr);
+ NETLIBHTTPREQUEST nlhr = { sizeof(nlhr) };
nlhr.requestType = REQUEST_POST;
nlhr.flags = NLHRF_GENERATEHOST | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP | NLHRF_NODUMPHEADERS;
nlhr.szUrl = reqUrl;
@@ -240,13 +239,17 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
mir_forkthread(ShellExecuteThread, mir_tstrdup(url));
}
-void OpenContactInbox(LPCSTR acc)
+void OpenContactInbox(HANDLE hContact)
{
- DBVARIANT dbv;
- if ( db_get_ts(0, acc, "jid", &dbv))
+ LPSTR acc = GetContactProto(hContact);
+ if (!acc)
+ return;
+
+ ptrT tszJid( db_get_tsa(0, acc, "jid"));
+ if (tszJid == NULL)
return;
- LPTSTR host = _tcschr(dbv.ptszVal, '@');
+ LPTSTR host = _tcschr(tszJid, '@');
if (!host)
return;
*host++ = 0;
@@ -256,7 +259,5 @@ void OpenContactInbox(LPCSTR acc)
mir_sntprintf(buf, SIZEOF(buf), INBOX_URL_FORMAT, _T("a/"), host); // hosted
else
mir_sntprintf(buf, SIZEOF(buf), INBOX_URL_FORMAT, _T(""), _T("mail")); // common
- OpenUrl(acc, dbv.ptszVal, buf);
-
- db_free(&dbv);
+ OpenUrl(acc, tszJid, buf);
}
diff --git a/protocols/GTalkExt/src/inbox.h b/protocols/GTalkExt/src/inbox.h
index 2b26a074ca..54c3686155 100644
--- a/protocols/GTalkExt/src/inbox.h
+++ b/protocols/GTalkExt/src/inbox.h
@@ -22,6 +22,6 @@
#pragma once
void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url);
-void OpenContactInbox(LPCSTR acc);
+void OpenContactInbox(HANDLE hContact);
-int InitMenus(WPARAM wParam, LPARAM lParam);
+BOOL InitMenus(BOOL init); \ No newline at end of file
diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp
index 31aa364710..6cbe2f2209 100644
--- a/protocols/GTalkExt/src/menu.cpp
+++ b/protocols/GTalkExt/src/menu.cpp
@@ -26,32 +26,72 @@
#include "inbox.h"
static const LPSTR MS_GTALKEXT_OPENMAILBOX = SHORT_PLUGIN_NAME "/OpenMailbox";
+static const LPTSTR _T(OPEN_MAILBOX_ITEM_CAPTION) = LPGENT("Open mailbox");
extern HICON g_hPopupIcon;
-INT_PTR OpenMailboxMenuHandler(WPARAM wParam, LPARAM lParam, LPARAM param)
+HANDLE hOpenMailboxService = 0;
+HANDLE hOnPrebuildMenu = 0;
+
+HGENMENU hOpenMailboxMenuItem = 0;
+
+INT_PTR OpenMailboxMenuHandler(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
+ OpenContactInbox(hContact);
+ return 0;
+}
+
+int OnPrebuildMenu(WPARAM wParam, LPARAM lParam)
{
- OpenContactInbox((LPCSTR)param);
+ CLISTMENUITEM cmi = { sizeof(cmi) };
+ cmi.flags = CMIM_FLAGS;
+ if (!db_get_b((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
+ cmi.flags |= CMIF_HIDDEN;
+ Menu_ModifyItem(hOpenMailboxMenuItem, &cmi);
return 0;
}
-int InitMenus(WPARAM wParam, LPARAM lParam)
+BOOL InitMenus(BOOL init)
{
- IJabberInterface *ji = (IJabberInterface*)lParam;
- LPCSTR szModuleName = ji->Sys()->GetModuleName();
- if ( IsGoogleAccount(szModuleName)) {
- char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s/%s", szModuleName, MS_GTALKEXT_OPENMAILBOX);
- CreateServiceFunctionParam(szServiceName, OpenMailboxMenuHandler, (LPARAM)szModuleName);
+ if (init) {
+ hOpenMailboxService = (HANDLE)CreateServiceFunction(MS_GTALKEXT_OPENMAILBOX, OpenMailboxMenuHandler);
+ if (!hOpenMailboxService) {
+ InitMenus(FALSE);
+ return FALSE;
+ }
+
+ extern HICON g_hPopupIcon;
CLISTMENUITEM cmi = { sizeof(cmi) };
- cmi.flags = CMIF_CHILDPOPUP;
- cmi.hParentMenu = HGENMENU(wParam);
+ cmi.flags = CMIF_TCHAR;
cmi.hIcon = g_hPopupIcon;
- cmi.position = 200101;
- cmi.pszName = LPGEN("Open mailbox");
- cmi.pszService = szServiceName;
- Menu_AddProtoMenuItem(&cmi);
+ cmi.ptszName = _T(OPEN_MAILBOX_ITEM_CAPTION);
+ cmi.pszService = MS_GTALKEXT_OPENMAILBOX;
+ hOpenMailboxMenuItem = Menu_AddContactMenuItem(&cmi);
+
+ if (!hOpenMailboxMenuItem) {
+ InitMenus(FALSE);
+ return FALSE;
+ }
+
+ hOnPrebuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildMenu);
+ if (!hOnPrebuildMenu) {
+ InitMenus(FALSE);
+ return FALSE;
+ }
}
- return 0;
+ else {
+ if (hOnPrebuildMenu) {
+ UnhookEvent(hOnPrebuildMenu);
+ hOnPrebuildMenu = 0;
+ }
+ if (hOpenMailboxService) {
+ DestroyServiceFunction(hOpenMailboxService);
+ hOpenMailboxService = 0;
+ }
+ }
+
+ return TRUE;
}
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp
index b1d52d0d51..373ca1cbba 100644
--- a/protocols/GTalkExt/src/notifications.cpp
+++ b/protocols/GTalkExt/src/notifications.cpp
@@ -28,7 +28,9 @@
const LPTSTR _T(NUMBER_EMAILS_MESSAGE) = LPGENT("You've received an e-mail\n%s unread threads");
const LPTSTR PLUGIN_DATA_PROP_NAME = _T("{DB5CE833-C3AC-4851-831C-DDEBD9FA0508}");
+const LPTSTR EVT_DELETED_HOOK_PROP_NAME = _T("{87CBD2BC-8806-413C-8FD5-1D61ABCA4AF8}");
+#define EVENT_DELETED_MSG RegisterWindowMessage(_T("{B9B00536-86A0-4BCE-B2FE-4ABD409C22AE}"))
#define MESSAGE_CLOSEPOPUP RegisterWindowMessage(_T("{7A60EA87-3E77-41DF-8A69-59B147F0C9C6}"))
const LPSTR CLIST_MODULE_NAME = "CList";
@@ -38,6 +40,9 @@ const LPSTR UNREAD_THREADS_SETTING = "UnreadThreads";
struct POPUP_DATA_HEADER
{
+ BOOL MarkRead;
+ HANDLE hDbEvent;
+ HANDLE hContact;
LPTSTR jid;
LPTSTR url;
};
@@ -64,20 +69,61 @@ LPCSTR GetJidAcc(LPCTSTR jid)
return NULL;
}
+void MarkEventRead(HANDLE hCnt, HANDLE hEvt)
+{
+ DWORD settings = (DWORD)TlsGetValue(itlsSettings);
+ if (ReadCheckbox(0, IDC_POPUPSENABLED, settings) &&
+ ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) &&
+ ReadCheckbox(0, IDC_MARKEVENTREAD, settings) &&
+ db_event_markRead(hCnt, hEvt) != -1)
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hCnt, (LPARAM)hEvt);
+}
+
+int OnEventDeleted(WPARAM hContact, LPARAM hDbEvent, LPARAM wnd)
+{
+ if (db_get_b((HANDLE)hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
+ CallService(MS_CLIST_REMOVEEVENT, hContact, hDbEvent);
+ PostMessage((HWND)wnd, EVENT_DELETED_MSG, hContact, hDbEvent);
+ }
+
+ return 0;
+}
+
LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd);
LPCSTR acc;
- if (MESSAGE_CLOSEPOPUP == msg)
+ if (EVENT_DELETED_MSG == msg) {
+ if ((HANDLE)lParam == ppdh->hDbEvent)
+ ppdh->hDbEvent = NULL;
+ return 0;
+ }
+
+ if (MESSAGE_CLOSEPOPUP == msg) {
+ ppdh->MarkRead = TRUE;
PUDeletePopup(wnd);
+ }
switch (msg) {
case UM_INITPOPUP:
SetProp(wnd, PLUGIN_DATA_PROP_NAME, (HANDLE)ppdh);
+ SetProp(wnd, EVT_DELETED_HOOK_PROP_NAME,
+ HookEventParam(ME_DB_EVENT_DELETED, OnEventDeleted, (LPARAM)wnd));
return 0;
case UM_FREEPLUGINDATA:
+ {
+ HANDLE hHook = GetProp(wnd, EVT_DELETED_HOOK_PROP_NAME);
+ RemoveProp(wnd, EVT_DELETED_HOOK_PROP_NAME);
+ UnhookEvent(hHook);
+ }
+
+ if (ppdh->MarkRead && ppdh->hDbEvent && (acc = GetJidAcc(ppdh->jid))) {
+ ReadNotificationSettings(acc);
+ MarkEventRead(ppdh->hContact, ppdh->hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)ppdh->hContact, (LPARAM)ppdh->hDbEvent);
+ }
RemoveProp(wnd, PLUGIN_DATA_PROP_NAME);
free(ppdh);
return 0;
@@ -130,6 +176,47 @@ void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCoun
wsprintf(buff, _T("%s"), jid); //!!!!!!!!!!!
}
+HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName)
+{
+ HANDLE result = (HANDLE)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0);
+ if (!result || !db_get_b(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
+ result = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ db_set_dw(0, acc, PSEUDOCONTACT_LINK, (DWORD)result);
+ db_set_b(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 1);
+ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)result, (LPARAM)acc);
+ }
+
+ // SetAvatar(result);
+
+ if (displayName == NULL) {
+ TCHAR *tszTemp = (TCHAR*)alloca((lstrlen(jid) + lstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR));
+ FormatPseudocontactDisplayName(tszTemp, jid, unreadCount);
+ db_set_ts(result, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp);
+ }
+ else db_set_ts(result, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, displayName);
+
+ db_set_ts(result, CLIST_MODULE_NAME, STATUS_MSG_SETTING, TranslateTS(MAIL_NOTIFICATIONS));
+ db_set_ts(result, SHORT_PLUGIN_NAME, UNREAD_THREADS_SETTING, unreadCount);
+
+ return result;
+}
+
+HANDLE AddCListNotification(HANDLE hContact, LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount)
+{
+ mir_ptr<char> szUrl( mir_utf8encodeT(url)), szText( mir_utf8encodeT(data->lptzText));
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.szModule = (LPSTR)acc;
+ dbei.timestamp = time(NULL);
+ dbei.flags = DBEF_UTF;
+ dbei.eventType = EVENTTYPE_MESSAGE;
+
+ char szEventText[4096];
+ dbei.cbBlob = mir_snprintf(szEventText, SIZEOF(szEventText), "%s\r\n%s", szUrl, szText);
+ dbei.pBlob = (PBYTE)szEventText;
+ return db_event_add(hContact, &dbei);
+}
+
BOOL UsePopups()
{
return ServiceExists(MS_POPUP_QUERY) &&
@@ -139,6 +226,10 @@ BOOL UsePopups()
void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount)
{
+ HANDLE hCnt = SetupPseudocontact(jid, unreadCount, acc, &data->lptzContactName[0]);
+ HANDLE hEvt = ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, (DWORD)TlsGetValue(itlsSettings))
+ ? AddCListNotification(hCnt, acc, data, jid, url, unreadCount) : NULL;
+
if (!UsePopups())
return;
@@ -157,6 +248,9 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP
int ljid = (lstrlen(jid) + 1) * sizeof(TCHAR);
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid);
+ ppdh->MarkRead = FALSE;
+ ppdh->hContact = hCnt;
+ ppdh->hDbEvent = hEvt;
ppdh->jid = (LPTSTR)((PBYTE)ppdh + sizeof(*ppdh));
memcpy(ppdh->jid, jid, ljid);
@@ -201,6 +295,15 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre
ShowNotification(acc, &data, jid, url, unreadCount);
}
+void ClearNotificationContactHistory(LPCSTR acc)
+{
+ HANDLE hEvent = 0;
+ HANDLE hContact = (HANDLE)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0);
+ if (hContact && db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
+ while ((hEvent = db_event_last(hContact)) && !db_event_delete(hContact, hEvent))
+ ;
+}
+
DWORD ReadNotificationSettings(LPCSTR acc)
{
DWORD result = ReadCheckboxes(0, acc);
@@ -233,6 +336,12 @@ BOOL CALLBACK ClosePopupFunc(__in HWND hwnd, __in LPARAM lParam)
void CloseNotifications(LPCSTR acc, LPCTSTR url, LPCTSTR jid, BOOL PopupsOnly)
{
+ DWORD settings = (DWORD)TlsGetValue(itlsSettings);
+ if (acc && !PopupsOnly &&
+ ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) &&
+ ReadCheckbox(0, IDC_CLEARPSEUDOCONTACTLOG, settings))
+ ClearNotificationContactHistory(acc);
+
POPUP_IDENT_STRINGS pis = {url, jid};
EnumWindows(ClosePopupFunc, (LPARAM)&pis);
}
diff --git a/protocols/GTalkExt/src/notifications.h b/protocols/GTalkExt/src/notifications.h
index 76f164ce4b..02780ae2b0 100644
--- a/protocols/GTalkExt/src/notifications.h
+++ b/protocols/GTalkExt/src/notifications.h
@@ -40,4 +40,5 @@ void UnreadMailNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unread
void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount, const MAIL_THREAD_NOTIFICATION *mtn);
void CloseNotifications(LPCSTR acc, LPCTSTR url, LPCTSTR jid, BOOL PopupsOnly);
DWORD ReadNotificationSettings(LPCSTR acc);
+HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName = NULL);
LPCSTR GetJidAcc(LPCTSTR jid); \ No newline at end of file
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp
index e463c0d2a6..7cf97347b8 100644
--- a/protocols/GTalkExt/src/options.cpp
+++ b/protocols/GTalkExt/src/options.cpp
@@ -43,7 +43,17 @@ void CheckControlsEnabled(HWND wnd)
BOOL PopupsEnabled = (SendDlgItemMessage(wnd, IDC_POPUPSENABLED, BM_GETSTATE, 0, 0) & BST_CHECKED) == BST_CHECKED;
EnableWindow(GetDlgItem(wnd, IDC_POPUPSINFULLSCREEN), PopupsEnabled);
EnableWindow(GetDlgItem(wnd, IDC_POPUPSINFULLSCREENLABEL), PopupsEnabled);
- EnableWindow(GetDlgItem(wnd, IDC_ADDSNIP), PopupsEnabled);
+
+ BOOL CListEnabled = (SendMessage(GetDlgItem(wnd, IDC_PSEUDOCONTACTENABLED), BM_GETSTATE, 0, 0) & BST_CHECKED) == BST_CHECKED;
+ EnableWindow(GetDlgItem(wnd, IDC_CLEARPSEUDOCONTACTLOG), CListEnabled);
+
+ EnableWindow(GetDlgItem(wnd, IDC_MARKEVENTREAD), PopupsEnabled && CListEnabled);
+ EnableWindow(GetDlgItem(wnd, IDC_ADDSNIP), PopupsEnabled || CListEnabled);
+
+ EnableWindow(GetDlgItem(wnd, IDC_MAILBOXVIEWLABEL), PopupsEnabled || CListEnabled);
+ EnableWindow(GetDlgItem(wnd, IDC_UNKNOWNVIEW), PopupsEnabled || CListEnabled);
+ EnableWindow(GetDlgItem(wnd, IDC_STANDARDVIEW), PopupsEnabled || CListEnabled);
+ EnableWindow(GetDlgItem(wnd, IDC_HTMLVIEW), PopupsEnabled || CListEnabled);
EnableWindow(GetDlgItem(wnd, IDC_MAILBOXVIEWLABEL), PopupsEnabled);
EnableWindow(GetDlgItem(wnd, IDC_UNKNOWNVIEW), PopupsEnabled);
@@ -63,7 +73,10 @@ DWORD ReadCheckboxes(HWND wnd, LPCSTR mod)
{
DWORD controls = db_get_dw(0, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, 0);
ReadCheckbox(wnd, IDC_POPUPSENABLED, controls);
+ ReadCheckbox(wnd, IDC_PSEUDOCONTACTENABLED, controls);
+ ReadCheckbox(wnd, IDC_CLEARPSEUDOCONTACTLOG, controls);
ReadCheckbox(wnd, IDC_POPUPSINFULLSCREEN, controls);
+ ReadCheckbox(wnd, IDC_MARKEVENTREAD, controls);
ReadCheckbox(wnd, IDC_AUTHONMAILBOX, controls);
ReadCheckbox(wnd, IDC_ADDSNIP, controls);
ReadCheckbox(wnd, IDC_UNKNOWNVIEW, controls);
@@ -81,9 +94,11 @@ DWORD GetCheckboxSaveValue(HWND wnd, int id)
void SaveControls(HWND wnd, LPCSTR mod)
{
- DWORD controls =
+ DWORD controls = GetCheckboxSaveValue(wnd, IDC_CLEARPSEUDOCONTACTLOG) |
GetCheckboxSaveValue(wnd, IDC_POPUPSINFULLSCREEN) |
GetCheckboxSaveValue(wnd, IDC_POPUPSENABLED) |
+ GetCheckboxSaveValue(wnd, IDC_PSEUDOCONTACTENABLED) |
+ GetCheckboxSaveValue(wnd, IDC_MARKEVENTREAD) |
GetCheckboxSaveValue(wnd, IDC_AUTHONMAILBOX) |
GetCheckboxSaveValue(wnd, IDC_ADDSNIP) |
GetCheckboxSaveValue(wnd, IDC_UNKNOWNVIEW) |
@@ -111,10 +126,13 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_POPUPSENABLED:
+ case IDC_PSEUDOCONTACTENABLED:
if (HIWORD(wParam) == BN_CLICKED) CheckControlsEnabled(wnd);
// no break
+ case IDC_CLEARPSEUDOCONTACTLOG:
case IDC_POPUPSINFULLSCREEN:
+ case IDC_MARKEVENTREAD:
case IDC_AUTHONMAILBOX:
case IDC_ADDSNIP:
case IDC_UNKNOWNVIEW:
@@ -217,8 +235,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM
void AddPopupsPage(WPARAM wParam)
{
- OPTIONSDIALOGPAGE odp = {0};
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.ptszTitle = MAIL_NOTIFICATIONS;
odp.pfnDlgProc = PopupsOptionsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPSETTINGS);
diff --git a/protocols/GTalkExt/src/options.h b/protocols/GTalkExt/src/options.h
index 2b9507b84e..ff9c2327e2 100644
--- a/protocols/GTalkExt/src/options.h
+++ b/protocols/GTalkExt/src/options.h
@@ -27,6 +27,8 @@ static const LPTSTR MAIL_NOTIFICATIONS = LPGENT("GMail notifications");
static const LPTSTR FULL_NOTIFICATION_FORMAT = LPGENT("subject\n %s\nfrom\n%s\n%s\n");
static const LPTSTR SHORT_NOTIFICATION_FORMAT = LPGENT("subject\n %s\nfrom\n%s");
+static const LPSTR PSEUDOCONTACT_LINK = "GTalkExtNotifyContact";
+static const LPSTR PSEUDOCONTACT_FLAG = "IsNotifyContact";
static const LPSTR BACK_COLOR_SETTING = "BackColor";
static const LPSTR TEXT_COLOR_SETTING = "TextColor";
static const LPSTR TIMEOUT_SETTING = "Timeout";
diff --git a/protocols/GTalkExt/src/resources.h b/protocols/GTalkExt/src/resources.h
index 7a5a10e63d..1b63b3c9e4 100644
--- a/protocols/GTalkExt/src/resources.h
+++ b/protocols/GTalkExt/src/resources.h
@@ -27,7 +27,10 @@
#define IDC_BASE 1001
#define IDC_POPUPSENABLED IDC_BASE + 0
+#define IDC_PSEUDOCONTACTENABLED IDC_BASE + 1
+#define IDC_CLEARPSEUDOCONTACTLOG IDC_BASE + 2
#define IDC_POPUPSINFULLSCREEN IDC_BASE + 3
+#define IDC_MARKEVENTREAD IDC_BASE + 5
#define IDC_AUTHONMAILBOX IDC_BASE + 6
#define IDC_ADDSNIP IDC_BASE + 7
#define IDC_UNKNOWNVIEW IDC_BASE + 8
diff --git a/protocols/GTalkExt/src/stdafx.h b/protocols/GTalkExt/src/stdafx.h
index 76fcb5ee0d..0a4dd456ee 100644
--- a/protocols/GTalkExt/src/stdafx.h
+++ b/protocols/GTalkExt/src/stdafx.h
@@ -65,3 +65,6 @@
#pragma warning(pop)
extern HINSTANCE g_hInst;
+
+void SetAvatar(HANDLE hContact);
+BOOL InitAvaUnit(BOOL init);