diff options
Diffstat (limited to 'protocols/WhatsApp/src/connection.cpp')
-rw-r--r-- | protocols/WhatsApp/src/connection.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
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;
|