diff options
author | George Hazan <george.hazan@gmail.com> | 2015-02-07 22:07:23 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-02-07 22:07:23 +0000 |
commit | c6d62e1b32d5469f7dc410ae7447df74086e00c7 (patch) | |
tree | a39f839f10192a471919fbc235685dd2b412c3e3 /protocols/WhatsApp/src | |
parent | d90fe4d921affc05fa77e4b3d554bc43d71d9b42 (diff) |
option to join chats on startup
git-svn-id: http://svn.miranda-ng.org/main/trunk@12048 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src')
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 6 | ||||
-rw-r--r-- | protocols/WhatsApp/src/db.h | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/dialogs.cpp | 31 | ||||
-rw-r--r-- | protocols/WhatsApp/src/resource.h | 4 |
4 files changed, 26 insertions, 16 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 0f574b2c93..853bc7b164 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -273,7 +273,7 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n }
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, (m_pConnection) ? WINDOW_HIDDEN : SESSION_INITDONE, (LPARAM)&gce);
+ CallServiceSync(MS_GC_EVENT, getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce);
CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
if (m_pConnection)
@@ -313,10 +313,6 @@ void WhatsAppProto::onGroupInfo(const std::string &jid, const std::string &owner onGroupNewSubject(jid, subject_owner, subject, time_subject);
}
-
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
}
void WhatsAppProto::onGroupMessage(const FMessage &pMsg)
diff --git a/protocols/WhatsApp/src/db.h b/protocols/WhatsApp/src/db.h index 38f1f16be0..16b88099d8 100644 --- a/protocols/WhatsApp/src/db.h +++ b/protocols/WhatsApp/src/db.h @@ -14,6 +14,7 @@ #define WHATSAPP_KEY_DEF_GROUP "DefaultGroup"
#define WHATSAPP_KEY_REG_CODE "RegistrationCode"
#define WHATSAPP_KEY_SSL "UseSSL"
+#define WHATSAPP_KEY_AUTORUNCHATS "AutoRunChats"
#define WHATSAPP_KEY_EVENT_CLIENT_ENABLE "EventClientEnable"
#define WHATSAPP_KEY_EVENT_OTHER_ENABLE "EventOtherEnable"
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 0d93fd2afd..e482cdfa9d 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -15,7 +15,9 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, 3, 0);
SendDlgItemMessage(hwndDlg, IDC_PW2, EM_LIMITTEXT, 3, 0);
- CheckDlgButton(hwndDlg, IDC_SSL, db_get_b(NULL, proto->m_szModuleName, WHATSAPP_KEY_SSL, 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_SSL, proto->getBool(WHATSAPP_KEY_SSL, false) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTORUN, proto->getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? BST_CHECKED : BST_UNCHECKED);
{
ptrA szStr(proto->getStringA(WHATSAPP_KEY_CC));
if (szStr != NULL)
@@ -81,15 +83,23 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA }
}
- if (HIWORD(wParam) == EN_CHANGE && reinterpret_cast<HWND>(lParam) == GetFocus()) {
- switch (LOWORD(wParam)) {
- case IDC_CC:
- case IDC_LOGIN:
- case IDC_NICK:
- case IDC_SSL:
- case IDC_PW:
- case IDC_PW2:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (HWND(lParam) == GetFocus()) {
+ if (HIWORD(wParam) == EN_CHANGE) {
+ switch (LOWORD(wParam)) {
+ case IDC_CC:
+ case IDC_LOGIN:
+ case IDC_NICK:
+ case IDC_PW:
+ case IDC_PW2:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+ else if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDC_AUTORUN:
+ case IDC_SSL:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
}
}
break;
@@ -108,6 +118,7 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA proto->setString(WHATSAPP_KEY_NICK, str);
proto->setByte(WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwndDlg, IDC_SSL));
+ proto->setByte(WHATSAPP_KEY_AUTORUNCHATS, IsDlgButtonChecked(hwndDlg, IDC_AUTORUN));
return TRUE;
}
break;
diff --git a/protocols/WhatsApp/src/resource.h b/protocols/WhatsApp/src/resource.h index ebab688804..64b7b1359a 100644 --- a/protocols/WhatsApp/src/resource.h +++ b/protocols/WhatsApp/src/resource.h @@ -19,11 +19,13 @@ #define IDC_BUTTON_REGISTER 1008
#define IDC_CC 1009
#define IDC_VALUE 1010
+#define IDC_SSL2 1010
#define IDC_CANCEL 1011
#define IDC_OK 1012
#define IDC_PW2 1013
#define IDC_TEXT 1014
#define IDC_INVITE 1015
+#define IDC_AUTORUN 1016
// Next default values for new objects
//
@@ -31,7 +33,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1016
+#define _APS_NEXT_CONTROL_VALUE 1017
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|