summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-06-10 15:09:08 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-06-10 15:09:08 +0000
commitcdf4d005c67b8b5ef62170ccd4fdd29579965d9c (patch)
treef38e6b34bca9be3054031ffdbcc85457796cda08 /protocols
parentf57abcc041abea72297fa3571cc07e46cf9802cd (diff)
removed password field, coz we can't change it
added checkbutton for using 443 port git-svn-id: http://svn.miranda-ng.org/main/trunk@4910 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/WhatsApp/res/whatsapp.rcbin8174 -> 8154 bytes
-rw-r--r--protocols/WhatsApp/src/connection.cpp22
-rw-r--r--protocols/WhatsApp/src/db.h1
-rw-r--r--protocols/WhatsApp/src/dialogs.cpp31
-rw-r--r--protocols/WhatsApp/src/resource.hbin2910 -> 2914 bytes
5 files changed, 27 insertions, 27 deletions
diff --git a/protocols/WhatsApp/res/whatsapp.rc b/protocols/WhatsApp/res/whatsapp.rc
index 735f33f473..51c5e2281c 100644
--- a/protocols/WhatsApp/res/whatsapp.rc
+++ b/protocols/WhatsApp/res/whatsapp.rc
Binary files differ
diff --git a/protocols/WhatsApp/src/connection.cpp b/protocols/WhatsApp/src/connection.cpp
index 7ec41e27e4..39cbf96e54 100644
--- a/protocols/WhatsApp/src/connection.cpp
+++ b/protocols/WhatsApp/src/connection.cpp
@@ -143,13 +143,23 @@ void WhatsAppProto::stayConnectedLoop(void*)
CODE_BLOCK_TRY
- this->conn = new WASocketConnection("c.whatsapp.net", 5222);
+ BYTE UseSSL = db_get_b(NULL, this->ModuleName(), WHATSAPP_KEY_SSL, 0);
+ if (UseSSL) {
+ this->conn = new WASocketConnection("c.whatsapp.net", 443);
+
+ connection = new WAConnection(&this->connMutex, this, this);
+ login = new WALogin(connection, new BinTreeNodeReader(connection, conn, WAConnection::dictionary, WAConnection::DICTIONARY_LEN),
+ new BinTreeNodeWriter(connection, conn, WAConnection::dictionary, WAConnection::DICTIONARY_LEN, &writerMutex),
+ "s.whatsapp.net", this->phoneNumber, std::string(ACCOUNT_RESOURCE) +"-443", base64_decode(pass), nick);
+ } else {
+ this->conn = new WASocketConnection("c.whatsapp.net", 5222);
+
+ connection = new WAConnection(&this->connMutex, this, this);
+ login = new WALogin(connection, new BinTreeNodeReader(connection, conn, WAConnection::dictionary, WAConnection::DICTIONARY_LEN),
+ new BinTreeNodeWriter(connection, conn, WAConnection::dictionary, WAConnection::DICTIONARY_LEN, &writerMutex),
+ "s.whatsapp.net", this->phoneNumber, std::string(ACCOUNT_RESOURCE) +"-5222", base64_decode(pass), nick);
+ }
- connection = new WAConnection(&this->connMutex, this, this);
- login = new WALogin(connection, new BinTreeNodeReader(connection, conn, WAConnection::dictionary, WAConnection::DICTIONARY_LEN),
- new BinTreeNodeWriter(connection, conn, WAConnection::dictionary, WAConnection::DICTIONARY_LEN, &writerMutex),
- "s.whatsapp.net", this->phoneNumber, std::string(ACCOUNT_RESOURCE) +"-5222", base64_decode(pass), nick);
-
std::vector<unsigned char>* nextChallenge = login->login(*this->challenge);
delete this->challenge;
this->challenge = nextChallenge;
diff --git a/protocols/WhatsApp/src/db.h b/protocols/WhatsApp/src/db.h
index 596883e0e7..ef2610e523 100644
--- a/protocols/WhatsApp/src/db.h
+++ b/protocols/WhatsApp/src/db.h
@@ -32,6 +32,7 @@
#define WHATSAPP_KEY_SYSTRAY_NOTIFY "UseSystrayNotify"
#define WHATSAPP_KEY_DEF_GROUP "DefaultGroup"
#define WHATSAPP_KEY_REG_CODE "RegistrationCode"
+#define WHATSAPP_KEY_SSL "UseSSL"
#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 6905ca4b87..c1e4807a17 100644
--- a/protocols/WhatsApp/src/dialogs.cpp
+++ b/protocols/WhatsApp/src/dialogs.cpp
@@ -13,7 +13,7 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA
SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
SendDlgItemMessage(hwnd, IDC_REG_CODE_1, EM_LIMITTEXT, 3, 0);
SendDlgItemMessage(hwnd, IDC_REG_CODE_2, EM_LIMITTEXT, 3, 0);
-
+ CheckDlgButton(hwnd, IDC_SSL, db_get_b(NULL, proto->ModuleName(), WHATSAPP_KEY_SSL, 0));
DBVARIANT dbv;
if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_CC,&dbv,DBVT_ASCIIZ))
@@ -34,19 +34,11 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA
db_free(&dbv);
}
- if ( !db_get_s(0,proto->ModuleName(),WHATSAPP_KEY_PASS,&dbv,DBVT_ASCIIZ))
- {
- CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
- reinterpret_cast<LPARAM>(dbv.pszVal));
- SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
- db_free(&dbv);
- }
-
if (!proto->isOffline()) {
SendMessage(GetDlgItem(hwnd,IDC_CC),EM_SETREADONLY,1,0);
SendMessage(GetDlgItem(hwnd,IDC_LOGIN),EM_SETREADONLY,1,0);
SendMessage(GetDlgItem(hwnd,IDC_NICK),EM_SETREADONLY,1,0);
- SendMessage(GetDlgItem(hwnd,IDC_PW),EM_SETREADONLY,1,0);
+ EnableWindow(GetDlgItem(hwnd, IDC_SSL), FALSE);
}
return TRUE;
@@ -87,7 +79,6 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA
string pw = proto->Register(REG_STATE_REG_CODE, string(cc), string(number), string(code));
if (!pw.empty())
{
- SetDlgItemTextA(hwnd, IDC_PW, pw.c_str());
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(pw.c_str()), (LPARAM)pw.c_str());
db_set_s(NULL, proto->ModuleName(), WHATSAPP_KEY_PASS, pw.c_str());
MessageBox(NULL, TranslateT("Your password has been set automatically.\nIf you change your password manually you may lose it and need to request a new code!"), PRODUCT_NAME, MB_ICONWARNING);
@@ -102,30 +93,28 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPA
case IDC_CC:
case IDC_LOGIN:
case IDC_NICK:
- case IDC_PW:
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
+ case IDC_SSL:
+ SendMessage(GetParent(hwnd) ,PSM_CHANGED, 0, 0);
}
}
break;
case WM_NOTIFY:
- if ( reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY )
+ if (reinterpret_cast<NMHDR *>(lparam)->code == PSN_APPLY)
{
- proto = reinterpret_cast<WhatsAppProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
+ proto = reinterpret_cast<WhatsAppProto *>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
char str[128];
GetDlgItemTextA(hwnd, IDC_CC, str, sizeof(str));
- db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_CC,str);
+ db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_CC, str);
GetDlgItemTextA(hwnd, IDC_LOGIN, str, sizeof(str));
- db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_LOGIN,str);
+ db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_LOGIN, str);
GetDlgItemTextA(hwnd, IDC_NICK, str, sizeof(str));
- db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_NICK,str);
+ db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_NICK, str);
- GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
- CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
- db_set_s(0,proto->ModuleName(),WHATSAPP_KEY_PASS,str);
+ db_set_b(0, proto->ModuleName(), WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwnd, IDC_SSL));
return TRUE;
}
diff --git a/protocols/WhatsApp/src/resource.h b/protocols/WhatsApp/src/resource.h
index 374c74cd4b..f9e3479b8e 100644
--- a/protocols/WhatsApp/src/resource.h
+++ b/protocols/WhatsApp/src/resource.h
Binary files differ