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 | |
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')
-rw-r--r-- | protocols/WhatsApp/res/whatsapp.rc | 15 | ||||
-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 |
5 files changed, 30 insertions, 27 deletions
diff --git a/protocols/WhatsApp/res/whatsapp.rc b/protocols/WhatsApp/res/whatsapp.rc index a5a0e2cb5d..cf57963b54 100644 --- a/protocols/WhatsApp/res/whatsapp.rc +++ b/protocols/WhatsApp/res/whatsapp.rc @@ -57,15 +57,7 @@ BEGIN BEGIN
VERTGUIDE, 60
VERTGUIDE, 178
- END
-
- IDD_INPUTBOX, DIALOG
- BEGIN
- VERTGUIDE, 12
- VERTGUIDE, 224
- VERTGUIDE, 228
- BOTTOMMARGIN, 59
- HORZGUIDE, 45
+ BOTTOMMARGIN, 126
END
END
#endif // APSTUDIO_INVOKED
@@ -76,7 +68,7 @@ END // Dialog
//
-IDD_WHATSAPOPTIONS DIALOGEX 0, 0, 185, 126
+IDD_WHATSAPOPTIONS DIALOGEX 0, 0, 185, 136
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x0
@@ -94,6 +86,7 @@ BEGIN PUSHBUTTON "Register code",IDC_BUTTON_REGISTER,98,80,81,18
CONTROL "Use SSL connection (port 443)",IDC_SSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,108,173,10
CTEXT "-",IDC_STATIC,82,62,8,8
+ CONTROL "Automatically open group chats",IDC_AUTORUN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,120,173,10
END
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 170
@@ -109,6 +102,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,162,152,50,14
END
+
/////////////////////////////////////////////////////////////////////////////
//
// Icon
@@ -118,7 +112,6 @@ END // remains consistent on all systems.
IDI_WHATSAPP ICON "whatsapp.ico"
IDI_ADD_GROUP ICON "add-group.ico"
-
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
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
|