diff options
| author | George Hazan <george.hazan@gmail.com> | 2014-02-12 13:56:04 +0000 | 
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2014-02-12 13:56:04 +0000 | 
| commit | 7d9f85b1487f0f25d6d616d5cd9af61962af7781 (patch) | |
| tree | ce48b29f0ae55f14df7cadcfce15dd9085a55221 | |
| parent | b3f02d29dda9fb6d0818ed47103160520ac1695d (diff) | |
GTalkExt: no need to renew pseudocontact's handle anymore
git-svn-id: http://svn.miranda-ng.org/main/trunk@8108 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
| -rw-r--r-- | protocols/GTalkExt/src/Version.h | 4 | ||||
| -rw-r--r-- | protocols/GTalkExt/src/avatar.cpp | 6 | ||||
| -rw-r--r-- | protocols/GTalkExt/src/db.cpp | 18 | ||||
| -rw-r--r-- | protocols/GTalkExt/src/db.h | 2 | ||||
| -rw-r--r-- | protocols/GTalkExt/src/handlers.cpp | 2 | ||||
| -rw-r--r-- | protocols/GTalkExt/src/notifications.cpp | 27 | ||||
| -rw-r--r-- | protocols/GTalkExt/src/options.cpp | 8 | 
7 files changed, 22 insertions, 45 deletions
| diff --git a/protocols/GTalkExt/src/Version.h b/protocols/GTalkExt/src/Version.h index 4b485aca5d..efc0f8eb88 100644 --- a/protocols/GTalkExt/src/Version.h +++ b/protocols/GTalkExt/src/Version.h @@ -1,7 +1,7 @@  #define __MAJOR_VERSION            0
  #define __MINOR_VERSION            1
 -#define __RELEASE_NUM            0
 -#define __BUILD_NUM               2
 +#define __RELEASE_NUM              1
 +#define __BUILD_NUM                0
  #include <stdver.h>
 diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index e3ded257f1..5b464b1ae3 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -150,7 +150,7 @@ void SetAvatar(MCONTACT hContact)  {
  	mir_cslock lck(g_csSetAvatar);
 -	avatarCacheEntry *ava = (avatarCacheEntry*)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
 +	avatarCacheEntry *ava = (avatarCacheEntry*)CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
  	if (ava && GetFileAttributes(&ava->szFilename[0]) != INVALID_FILE_ATTRIBUTES)
  		return;
 @@ -165,7 +165,7 @@ void SetAvatar(MCONTACT hContact)  		return;
  	if (ava)
 -		CallService(MS_AV_SETAVATART, (WPARAM)hContact, (LPARAM)_T(""));
 -	CallService(MS_AV_SETAVATART, (WPARAM)hContact, (LPARAM)avaFile);
 +		CallService(MS_AV_SETAVATART, hContact, (LPARAM)_T(""));
 +	CallService(MS_AV_SETAVATART, hContact, (LPARAM)avaFile);
  	db_set_ts(hContact, SRMM_MODULE_NAME, SRMM_AVATAR_SETTING_NAME, avaFile);
  }
 diff --git a/protocols/GTalkExt/src/db.cpp b/protocols/GTalkExt/src/db.cpp index bbda342b2b..691e065bc3 100644 --- a/protocols/GTalkExt/src/db.cpp +++ b/protocols/GTalkExt/src/db.cpp @@ -31,21 +31,3 @@ 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 (MCONTACT 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 2f512ff671..d07b44e7ab 100644 --- a/protocols/GTalkExt/src/db.h +++ b/protocols/GTalkExt/src/db.h @@ -27,5 +27,3 @@  LPTSTR ReadJidSetting(LPCSTR name, LPCTSTR jid);
  void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting);
 -
 -void RenewPseudocontactHandles();
 diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 96ac5e94e6..8c3817474f 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -465,8 +465,6 @@ int AccListChanged(WPARAM wParam, LPARAM lParam)  int ModulesLoaded(WPARAM wParam, LPARAM lParam)
  {
 -	RenewPseudocontactHandles();
 -
  	int count;
  	PROTOACCOUNT **protos;
  	ProtoEnumAccounts(&count, &protos);
 diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index f9dc9e9111..ba527abe5e 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -168,27 +168,26 @@ void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCoun  MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName)
  {
 -	MCONTACT result = (MCONTACT)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0);
 -	if (!result || !db_get_b(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
 -		result = (MCONTACT)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);
 +	MCONTACT hContact = db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0);
 +	if (!hContact || !db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
 +		hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
 +		db_set_dw(0, acc, PSEUDOCONTACT_LINK, hContact);
 +		db_set_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 1);
 +		CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)acc);
  	}
 -	// SetAvatar(result);
 +	// SetAvatar(hContact);
  	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);
 +		db_set_ts(hContact, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp);
  	}
 -	else db_set_ts(result, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, displayName);
 +	else db_set_ts(hContact, 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;
 +	db_set_ts(hContact, CLIST_MODULE_NAME, STATUS_MSG_SETTING, TranslateTS(MAIL_NOTIFICATIONS));
 +	db_set_ts(hContact, SHORT_PLUGIN_NAME, UNREAD_THREADS_SETTING, unreadCount);
 +	return hContact;
  }
  HANDLE AddCListNotification(MCONTACT hContact, LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount)
 @@ -287,7 +286,7 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre  void ClearNotificationContactHistory(LPCSTR acc)
  {
 -	MCONTACT hContact = (MCONTACT)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0);
 +	MCONTACT hContact = db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0);
  	if (!hContact || !db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0))
  		return;
 diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index fa9fe637a2..cd199fdcb9 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -145,7 +145,7 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa  		break;
  	case WM_NOTIFY:
 -		if (!((LPNMHDR)lParam)->idFrom  && ((LPNMHDR)lParam)->code == PSN_APPLY)
 +		if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY)
  			SaveControls(wnd, (LPCSTR)GetProp(wnd, ACCOUNT_PROP_NAME));
  		break;
  	}
 @@ -156,7 +156,7 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa  void ShowTestPopup(HWND wnd)
  {
 -	POPUPDATAT data = {0};
 +	POPUPDATAT data = { 0 };
  	mir_sntprintf(data.lptzContactName, MAX_CONTACTNAME, TranslateTS(TEST_LETTER_INBOX));
  	mir_sntprintf(data.lptzText, MAX_SECONDLINE, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP));
 @@ -191,7 +191,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM  		SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
  		SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
 -		_itot( db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0), timeout, 10);
 +		_itot(db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0), timeout, 10);
  		SetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout);
  		SetProp(wnd, DIALOG_INITIALIZED_PROP_NAME, (HANDLE)TRUE);
 @@ -214,7 +214,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM  		break;
  	case WM_NOTIFY:
 -		if (!((LPNMHDR)lParam)->idFrom  && ((LPNMHDR)lParam)->code == PSN_APPLY)
 +		if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY)
  			db_set_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_GETCOLOUR, 0, 0));
  		db_set_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_GETCOLOUR, 0, 0));
 | 
