diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-28 18:51:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-28 18:51:21 +0000 |
commit | 6f585711fa09225acea8dd58f72c24535c10cb00 (patch) | |
tree | e3d4fa28eb50c05d73f9bad4b7fe9cb6c4b9669c /protocols/GTalkExt/src | |
parent | c72a0b6171fca66ba363ec7148a1cc03459a0c2f (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@6262 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/GTalkExt/src')
-rw-r--r-- | protocols/GTalkExt/src/avatar.cpp | 10 | ||||
-rw-r--r-- | protocols/GTalkExt/src/db.h | 4 | ||||
-rw-r--r-- | protocols/GTalkExt/src/handlers.cpp | 94 | ||||
-rw-r--r-- | protocols/GTalkExt/src/handlers.h | 3 | ||||
-rw-r--r-- | protocols/GTalkExt/src/inbox.cpp | 37 | ||||
-rw-r--r-- | protocols/GTalkExt/src/menu.cpp | 6 | ||||
-rw-r--r-- | protocols/GTalkExt/src/notifications.cpp | 16 | ||||
-rw-r--r-- | protocols/GTalkExt/src/notifications.h | 4 | ||||
-rw-r--r-- | protocols/GTalkExt/src/options.cpp | 81 | ||||
-rw-r--r-- | protocols/GTalkExt/src/options.h | 19 | ||||
-rw-r--r-- | protocols/GTalkExt/src/tipper_items.cpp | 22 | ||||
-rw-r--r-- | protocols/GTalkExt/src/tipper_items.h | 24 |
12 files changed, 136 insertions, 184 deletions
diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index 9ab5cf4422..74359484f9 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -23,12 +23,12 @@ #include "resources.h"
#include "options.h"
-static const LPTSTR AVA_FILE_NAME_FORMAT = _T("%s\\%s\\AvatarCache\\Jabber\\") _T(SHORT_PLUGIN_NAME) _T(".pseudoava.png");
-static const LPTSTR AVA_RES_TYPE = _T("PNG");
-static const LPSTR SRMM_MODULE_NAME = "SRMM";
-static const LPSTR SRMM_AVATAR_SETTING_NAME = "Avatar";
+#define AVA_FILE_NAME_FORMAT _T("%s\\%s\\AvatarCache\\Jabber\\") _T(SHORT_PLUGIN_NAME) _T(".pseudoava.png")
+#define AVA_RES_TYPE _T("PNG")
+#define SRMM_MODULE_NAME "SRMM"
+#define SRMM_AVATAR_SETTING_NAME "Avatar"
-static const int SET_AVATAR_INTERVAL = 2000;
+#define SET_AVATAR_INTERVAL 2000
LPTSTR CreateAvaFile(HANDLE *hFile)
{
diff --git a/protocols/GTalkExt/src/db.h b/protocols/GTalkExt/src/db.h index 6cecd89a1d..2f512ff671 100644 --- a/protocols/GTalkExt/src/db.h +++ b/protocols/GTalkExt/src/db.h @@ -22,8 +22,8 @@ #pragma once
#include "resources.h"
-static const LPSTR LAST_MAIL_TIME_FROM_JID = SHORT_PLUGIN_NAME ".LastMailTimeFromJid";
-static const LPSTR LAST_THREAD_ID_FROM_JID = SHORT_PLUGIN_NAME ".LastThreadIdFromJid";
+#define LAST_MAIL_TIME_FROM_JID SHORT_PLUGIN_NAME ".LastMailTimeFromJid"
+#define LAST_THREAD_ID_FROM_JID SHORT_PLUGIN_NAME ".LastThreadIdFromJid"
LPTSTR ReadJidSetting(LPCSTR name, LPCTSTR jid);
void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting);
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index a08c68c21a..d7d786f325 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -28,52 +28,52 @@ #define JABBER_EXT_GTALK_PMUC _T("pmuc-v1")
-static const LPCTSTR JABBER_IQID = _T("mir_");
-static const LPCTSTR JABBER_IQID_FORMAT = _T("mir_%d");
-
-static const LPCTSTR NOTIFY_FEATURE_XMLNS = _T("google:mail:notify");
-static const LPCTSTR SETTING_FEATURE_XMLNS = _T("google:setting");
-static const LPCTSTR DISCOVERY_XMLNS = _T("http://jabber.org/protocol/disco#info");
-
-static const LPCTSTR MESSAGE_URL_FORMAT_STANDARD = _T("%s/#inbox/%x%08x");
-static const LPCTSTR MESSAGE_URL_FORMAT_HTML = _T("%s/h/?v=c&th=%x%08x");
-
-static const LPCTSTR ATTRNAME_TYPE = _T("type");
-static const LPCTSTR ATTRNAME_FROM = _T("from");
-static const LPCTSTR ATTRNAME_TO = _T("to");
-static const LPCTSTR ATTRNAME_URL = _T("url");
-static const LPCTSTR ATTRNAME_TID = _T("tid");
-static const LPCTSTR ATTRNAME_UNREAD = _T("unread");
-static const LPCTSTR ATTRNAME_XMLNS = _T("xmlns");
-static const LPCTSTR ATTRNAME_ID = _T("id");
-static const LPCTSTR ATTRNAME_TOTAL_MATCHED = _T("total-matched");
-static const LPCTSTR ATTRNAME_NAME = _T("name");
-static const LPCTSTR ATTRNAME_ADDRESS = _T("address");
-static const LPCTSTR ATTRNAME_RESULT_TIME = _T("result-time");
-static const LPCTSTR ATTRNAME_NEWER_THAN_TIME = _T("newer-than-time");
-static const LPCTSTR ATTRNAME_NEWER_THAN_TID = _T("newer-than-tid");
-static const LPCTSTR ATTRNAME_VALUE = _T("value");
-static const LPCTSTR ATTRNAME_VAR = _T("var");
-
-static const LPCTSTR IQTYPE_RESULT = _T("result");
-static const LPCTSTR IQTYPE_SET = _T("set");
-static const LPCTSTR IQTYPE_GET = _T("get");
-
-static const LPCTSTR NODENAME_MAILBOX = _T("mailbox");
-static const LPCTSTR NODENAME_QUERY = _T("query");
-static const LPCTSTR NODENAME_IQ = _T("iq");
-static const LPCTSTR NODENAME_USERSETTING = _T("usersetting");
-static const LPCTSTR NODENAME_MAILNOTIFICATIONS = _T("mailnotifications");
-static const LPCTSTR NODENAME_SUBJECT = _T("subject");
-static const LPCTSTR NODENAME_SNIPPET = _T("snippet");
-static const LPCTSTR NODENAME_SENDERS = _T("senders");
-static const LPCTSTR NODENAME_FEATURE = _T("feature");
-static const LPCTSTR NODENAME_NEW_MAIL = _T("new-mail");
-
-static const LPCTSTR SETTING_TRUE = _T("true");
-
-static const DWORD RESPONSE_TIMEOUT = 1000 * 60 * 60;
-static const DWORD TIMER_INTERVAL = 1000 * 60 * 2;
+#define JABBER_IQID _T("mir_")
+#define JABBER_IQID_FORMAT _T("mir_%d")
+
+#define NOTIFY_FEATURE_XMLNS _T("google:mail:notify")
+#define SETTING_FEATURE_XMLNS _T("google:setting")
+#define DISCOVERY_XMLNS _T("http://jabber.org/protocol/disco#info")
+
+#define MESSAGE_URL_FORMAT_STANDARD _T("%s/#inbox/%x%08x")
+#define MESSAGE_URL_FORMAT_HTML _T("%s/h/?v=c&th=%x%08x")
+
+#define ATTRNAME_TYPE _T("type")
+#define ATTRNAME_FROM _T("from")
+#define ATTRNAME_TO _T("to")
+#define ATTRNAME_URL _T("url")
+#define ATTRNAME_TID _T("tid")
+#define ATTRNAME_UNREAD _T("unread")
+#define ATTRNAME_XMLNS _T("xmlns")
+#define ATTRNAME_ID _T("id")
+#define ATTRNAME_TOTAL_MATCHED _T("total-matched")
+#define ATTRNAME_NAME _T("name")
+#define ATTRNAME_ADDRESS _T("address")
+#define ATTRNAME_RESULT_TIME _T("result-time")
+#define ATTRNAME_NEWER_THAN_TIME _T("newer-than-time")
+#define ATTRNAME_NEWER_THAN_TID _T("newer-than-tid")
+#define ATTRNAME_VALUE _T("value")
+#define ATTRNAME_VAR _T("var")
+
+#define IQTYPE_RESULT _T("result")
+#define IQTYPE_SET _T("set")
+#define IQTYPE_GET _T("get")
+
+#define NODENAME_MAILBOX _T("mailbox")
+#define NODENAME_QUERY _T("query")
+#define NODENAME_IQ _T("iq")
+#define NODENAME_USERSETTING _T("usersetting")
+#define NODENAME_MAILNOTIFICATIONS _T("mailnotifications")
+#define NODENAME_SUBJECT _T("subject")
+#define NODENAME_SNIPPET _T("snippet")
+#define NODENAME_SENDERS _T("senders")
+#define NODENAME_FEATURE _T("feature")
+#define NODENAME_NEW_MAIL _T("new-mail")
+
+#define SETTING_TRUE _T("true")
+
+#define RESPONSE_TIMEOUT (1000 * 60 * 60)
+#define TIMER_INTERVAL (1000 * 60 * 2)
LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -429,6 +429,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_POPUP_FILTER, OnFilterPopup);
HookEvent(ME_JABBER_EXTLISTINIT, OnExtListInit);
- HookOptionsInitialization();
+ HookEvent(ME_OPT_INITIALISE, OptionsInitialization);
return 0;
}
diff --git a/protocols/GTalkExt/src/handlers.h b/protocols/GTalkExt/src/handlers.h index c9d7dd120d..3218cd2b1c 100644 --- a/protocols/GTalkExt/src/handlers.h +++ b/protocols/GTalkExt/src/handlers.h @@ -25,3 +25,6 @@ extern HANDLE hModulesLoaded; int ModulesLoaded(WPARAM wParam, LPARAM lParam);
int AccListChanged(WPARAM wParam, LPARAM lParam);
+int OptionsInitialization(WPARAM wParam, LPARAM lParam);
+
+void AddTipperItem();
\ No newline at end of file diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 2271972fbb..8e6a6c5625 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -25,39 +25,26 @@ #include "db.h"
#include "options.h"
-const LPTSTR COMMON_GMAIL_HOST1 = _T("gmail.com");
-const LPTSTR COMMON_GMAIL_HOST2 = _T("googlemail.com");
+#define COMMON_GMAIL_HOST1 _T("gmail.com")
+#define COMMON_GMAIL_HOST2 _T("googlemail.com")
-const LPSTR AUTH_REQUEST_URL = "https://www.google.com/accounts/ClientAuth";
-const LPSTR AUTH_REQUEST_PARAMS = "Email=%s&Passwd=%s&"
- "accountType=HOSTED_OR_GOOGLE&"
- "skipvpage=true&"
- "PersistentCookie=false";
+#define AUTH_REQUEST_URL "https://www.google.com/accounts/ClientAuth"
+#define AUTH_REQUEST_PARAMS "Email=%s&Passwd=%s&accountType=HOSTED_OR_GOOGLE&skipvpage=true&PersistentCookie=false"
-const LPSTR ISSUE_TOKEN_REQUEST_URL = "https://www.google.com/accounts/IssueAuthToken";
-const LPSTR ISSUE_TOKEN_REQUEST_PARAMS = "SID=%s&LSID=%s&"
- "Session=true&"
- "skipvpage=true&"
- "service=gaia";
-
-const LPSTR TOKEN_AUTH_URL = "https://www.google.com/accounts/TokenAuth?"\
- "auth=%s&"
- "service=mail&"
- "continue=%s&"
- "source=googletalk";
+#define ISSUE_TOKEN_REQUEST_URL "https://www.google.com/accounts/IssueAuthToken"
+#define ISSUE_TOKEN_REQUEST_PARAMS "SID=%s&LSID=%s&Session=true&skipvpage=true&service=gaia"
+#define TOKEN_AUTH_URL "https://www.google.com/accounts/TokenAuth?auth=%s&service=mail&continue=%s&source=googletalk"
const NETLIBHTTPHEADER HEADER_URL_ENCODED = {"Content-Type", "application/x-www-form-urlencoded"};
-const int HTTP_OK = 200;
-
-const LPSTR SID_KEY_NAME = "SID=";
-const LPSTR LSID_KEY_NAME = "LSID=";
+#define HTTP_OK 200
-const LPSTR LOGIN_PASS_SETTING_NAME = "LoginPassword";
+#define SID_KEY_NAME "SID="
+#define LSID_KEY_NAME "LSID="
-const LPTSTR INBOX_URL_FORMAT = _T("https://mail.google.com/%s%s/#inbox");
+#define LOGIN_PASS_SETTING_NAME "LoginPassword"
-const DWORD SIZE_OF_JABBER_OPTIONS = 243 * sizeof(DWORD);
+#define INBOX_URL_FORMAT _T("https://mail.google.com/%s%s/#inbox")
// 3 lines from netlib.h
#define GetNetlibHandleType(h) (h?*(int*)h:NLH_INVALID)
diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp index 6cbe2f2209..28f84ddb8b 100644 --- a/protocols/GTalkExt/src/menu.cpp +++ b/protocols/GTalkExt/src/menu.cpp @@ -25,8 +25,8 @@ #include "options.h"
#include "inbox.h"
-static const LPSTR MS_GTALKEXT_OPENMAILBOX = SHORT_PLUGIN_NAME "/OpenMailbox";
-static const LPTSTR _T(OPEN_MAILBOX_ITEM_CAPTION) = LPGENT("Open mailbox");
+#define MS_GTALKEXT_OPENMAILBOX SHORT_PLUGIN_NAME "/OpenMailbox"
+#define OPEN_MAILBOX_ITEM_CAPTION LPGENT("Open mailbox")
extern HICON g_hPopupIcon;
@@ -67,7 +67,7 @@ BOOL InitMenus(BOOL init) CLISTMENUITEM cmi = { sizeof(cmi) };
cmi.flags = CMIF_TCHAR;
cmi.hIcon = g_hPopupIcon;
- cmi.ptszName = _T(OPEN_MAILBOX_ITEM_CAPTION);
+ cmi.ptszName = OPEN_MAILBOX_ITEM_CAPTION;
cmi.pszService = MS_GTALKEXT_OPENMAILBOX;
hOpenMailboxMenuItem = Menu_AddContactMenuItem(&cmi);
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 4b911dbc6c..86259b5632 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -25,18 +25,18 @@ #include "options.h"
#include "inbox.h"
-const LPTSTR _T(NUMBER_EMAILS_MESSAGE) = LPGENT("You've received an e-mail\n%s unread threads");
+#define NUMBER_EMAILS_MESSAGE "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 PLUGIN_DATA_PROP_NAME _T("{DB5CE833-C3AC-4851-831C-DDEBD9FA0508}")
+#define EVT_DELETED_HOOK_PROP_NAME _T("{87CBD2BC-8806-413C-8FD5-1D61ABCA4AF8}")
-#define EVENT_DELETED_MSG RegisterWindowMessage(_T("{B9B00536-86A0-4BCE-B2FE-4ABD409C22AE}"))
+#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";
-const LPSTR CONTACT_DISPLAY_NAME_SETTING = "MyHandle";
-const LPSTR STATUS_MSG_SETTING = "StatusMsg";
-const LPSTR UNREAD_THREADS_SETTING = "UnreadThreads";
+#define CLIST_MODULE_NAME "CList"
+#define CONTACT_DISPLAY_NAME_SETTING "MyHandle"
+#define STATUS_MSG_SETTING "StatusMsg"
+#define UNREAD_THREADS_SETTING "UnreadThreads"
struct POPUP_DATA_HEADER
{
diff --git a/protocols/GTalkExt/src/notifications.h b/protocols/GTalkExt/src/notifications.h index 02780ae2b0..456cb3d366 100644 --- a/protocols/GTalkExt/src/notifications.h +++ b/protocols/GTalkExt/src/notifications.h @@ -21,9 +21,9 @@ #pragma once
-const LPTSTR TEMP_WINDOW_CLASS_NAME = _T("AntiShittyFullscreenDetectionWindowClass");
+#define TEMP_WINDOW_CLASS_NAME _T("AntiShittyFullscreenDetectionWindowClass")
-const int SENDER_COUNT = 10;
+#define SENDER_COUNT 10
struct SENDER {
LPCTSTR name;
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index 1f032c108e..4102e4fbfc 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -23,18 +23,18 @@ #include "db.h"
#include "options.h"
-static const LPTSTR ACCOUNT_PROP_NAME = _T("{BF447EBA-27AE-4DB7-893C-FC42A3F74D75}");
-static const LPTSTR DIALOG_INITIALIZED_PROP_NAME = _T("{5EE59FE5-679A-4A29-B0A1-03092E7AC20E}");
+#define ACCOUNT_PROP_NAME _T("{BF447EBA-27AE-4DB7-893C-FC42A3F74D75}")
+#define DIALOG_INITIALIZED_PROP_NAME _T("{5EE59FE5-679A-4A29-B0A1-03092E7AC20E}")
-static const LPTSTR POPUPS_OPTIONS_GROUP = LPGENT("Popups");
-static const LPTSTR NETWORK_OPTIONS_GROUP = LPGENT("Network");
+#define POPUPS_OPTIONS_GROUP LPGENT("Popups")
+#define NETWORK_OPTIONS_GROUP LPGENT("Network")
-static const LPSTR NOTIFY_SETTINGS_FROM_MOD_NAME = SHORT_PLUGIN_NAME ".NotifySettingsFromModName";
+#define NOTIFY_SETTINGS_FROM_MOD_NAME SHORT_PLUGIN_NAME ".NotifySettingsFromModName"
-static const LPTSTR TEST_LETTER_SUBJECT = LPGENT("Why C sucks");
-static const LPTSTR TEST_LETTER_INBOX = LPGENT("brickstrace@gmail.com [1]");
-static const LPTSTR TEST_LETTER_SENDER = LPGENT(" bems\n");
-static const LPTSTR TEST_LETTER_SNIP = LPGENT("* Primitive type system\n* No overloading\n* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n* No metaprogramming except preprocessor macros\n* No exceptions");
+#define TEST_LETTER_SUBJECT LPGENT("Why C sucks")
+#define TEST_LETTER_INBOX LPGENT("brickstrace@gmail.com [1]")
+#define TEST_LETTER_SENDER LPGENT(" bems\n")
+#define TEST_LETTER_SNIP LPGENT("* Primitive type system\n* No overloading\n* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n* No metaprogramming except preprocessor macros\n* No exceptions")
extern HINSTANCE g_hInst;
@@ -108,6 +108,8 @@ void SaveControls(HWND wnd, LPCSTR mod) db_set_dw(NULL, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, controls);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -150,6 +152,8 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
void ShowTestPopup(HWND wnd)
{
POPUPDATAT data = {0};
@@ -179,21 +183,16 @@ void ShowTestPopup(HWND wnd) INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ TCHAR timeout[20];
+
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(wnd);
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));
- {
- LPTSTR timeout = (LPTSTR)malloc(11 * sizeof(TCHAR));
- __try {
- wsprintf(timeout, _T("%d"), db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
- SetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout);
- }
- __finally {
- free(timeout);
- }
- }
+
+ _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);
break;
@@ -219,20 +218,14 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM 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));
- int len = SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXTLENGTH, 0, 0) + 1;
- LPTSTR timeout = (LPTSTR)malloc(len * sizeof(TCHAR));
- __try {
- GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, len);
- db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout));
- }
- __finally {
- free(timeout);
- }
- break;
+ GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, SIZEOF(timeout));
+ db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout));
}
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int OptionsInitialization(WPARAM wParam, LPARAM lParam)
{
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
@@ -249,24 +242,18 @@ int OptionsInitialization(WPARAM wParam, LPARAM lParam) 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);
+ if (pa != NULL) {
+ 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()
-{
- HookEvent(ME_OPT_INITIALISE, OptionsInitialization);
-}
diff --git a/protocols/GTalkExt/src/options.h b/protocols/GTalkExt/src/options.h index ff9c2327e2..b26f21b277 100644 --- a/protocols/GTalkExt/src/options.h +++ b/protocols/GTalkExt/src/options.h @@ -23,16 +23,17 @@ #include "resources.h"
-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");
+#define JABBER_FEAT_GTALK_PMUC _T("http://www.google.com/xmpp/protocol/pmuc/v1")
-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";
+#define MAIL_NOTIFICATIONS LPGENT("GMail notifications")
+#define FULL_NOTIFICATION_FORMAT LPGENT("subject\n %s\nfrom\n%s\n%s\n")
+#define SHORT_NOTIFICATION_FORMAT LPGENT("subject\n %s\nfrom\n%s")
+
+#define PSEUDOCONTACT_LINK "GTalkExtNotifyContact"
+#define PSEUDOCONTACT_FLAG "IsNotifyContact"
+#define BACK_COLOR_SETTING "BackColor"
+#define TEXT_COLOR_SETTING "TextColor"
+#define TIMEOUT_SETTING "Timeout"
-void HookOptionsInitialization();
DWORD ReadCheckboxes(HWND wnd, LPCSTR mod);
BOOL ReadCheckbox(HWND wnd, int id, DWORD controls);
\ No newline at end of file diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 869243e905..53db8d216e 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -20,17 +20,15 @@ //***************************************************************************************
#include "StdAfx.h"
-#include "tipper_items.h"
#include "resources.h"
-static const int MAX_TIPPER_ITEM_PROP = 6 ;
+#define VALUE_SETTING_PROP "DIValue%d"
+#define LABEL_SETTING_PROP "DILabel%d"
-static const LPSTR VALUE_SETTING_PROP = "DIValue%d";
-static const LPSTR LABEL_SETTING_PROP = "DILabel%d";
+#define LAST_WRITTEN_LABEL_SETTING "LastWrittenTipperLabel"
-static const LPSTR LAST_WRITTEN_LABEL_SETTING = "LastWrittenTipperLabel";
-
-static LPSTR TipperItemProps[MAX_TIPPER_ITEM_PROP] = {
+static LPSTR TipperItemProps[] =
+{
LABEL_SETTING_PROP,
"DILineAbove%d",
"DITipperVarsFirst%d",
@@ -39,10 +37,10 @@ static LPSTR TipperItemProps[MAX_TIPPER_ITEM_PROP] = { "DIVisible%d"
};
-static const LPSTR TIPPER_ITEMS_MOD_NAME = "Tipper_Items";
-static const LPSTR TIPPER_ITEM_COUNT_SETTING = "DINumValues";
-static const LPTSTR UNREAD_THREADS_RAW = _T("%raw:") _T(SHORT_PLUGIN_NAME) _T("/UnreadThreads%");
-static const LPTSTR UNREAD_THREADS_LABEL = LPGENT("Unread threads:");
+#define TIPPER_ITEMS_MOD_NAME "Tipper_Items"
+#define TIPPER_ITEM_COUNT_SETTING "DINumValues"
+#define UNREAD_THREADS_RAW _T("%raw:") _T(SHORT_PLUGIN_NAME) _T("/UnreadThreads%")
+#define UNREAD_THREADS_LABEL LPGENT("Unread threads:")
void ShiftTipperSettings(LPSTR buff, int count, LPSTR format)
{
@@ -114,7 +112,7 @@ void AddTipperItem() }
}
- for (i = 0; i < MAX_TIPPER_ITEM_PROP; i++)
+ for (i = 0; i < SIZEOF(TipperItemProps); i++)
ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
#define WRITE_TIPPER_PROPS(index, value)\
diff --git a/protocols/GTalkExt/src/tipper_items.h b/protocols/GTalkExt/src/tipper_items.h deleted file mode 100644 index 0b94d1fd24..0000000000 --- a/protocols/GTalkExt/src/tipper_items.h +++ /dev/null @@ -1,24 +0,0 @@ -//***************************************************************************************
-//
-// Google Extension plugin for the Miranda IM's Jabber protocol
-// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru)
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-//***************************************************************************************
-
-#pragma once
-
-void AddTipperItem();
\ No newline at end of file |