summaryrefslogtreecommitdiff
path: root/protocols/AimOscar/src
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-05-19 18:36:48 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-05-19 18:36:48 +0000
commitd04e6d87584b145046a62c660fac99bfd1acc947 (patch)
tree758f756798bd5dc524fb84a5da57d4c424f1b983 /protocols/AimOscar/src
parent891d3f7a7f73bcf472d4b9dec58734504df20307 (diff)
AIM:
-minor bugfixes git-svn-id: http://svn.miranda-ng.org/main/trunk@13697 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/AimOscar/src')
-rw-r--r--protocols/AimOscar/src/connection.cpp141
-rw-r--r--protocols/AimOscar/src/server.cpp4
-rw-r--r--protocols/AimOscar/src/ui.cpp4
-rw-r--r--protocols/AimOscar/src/utility.cpp2
4 files changed, 74 insertions, 77 deletions
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index d813cb5646..1961da1dbc 100644
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -61,84 +61,81 @@ HANDLE CAimProto::aim_peer_connect(unsigned long ip, unsigned short port)
void CAimProto::aim_connection_authorization(void)
{
- NETLIBPACKETRECVER packetRecv = {0};
- HANDLE hServerPacketRecver = NULL;
-
- if (m_iDesiredStatus == ID_STATUS_OFFLINE)
- goto exit;
-
- char *password = getStringA(AIM_KEY_PW);
- if (password == NULL)
- goto exit;
-
- mir_free(username);
- username = getStringA(AIM_KEY_SN);
- if (username == NULL)
- goto exit;
-
- hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 2048 * 4);
- packetRecv.cbSize = sizeof(packetRecv);
- packetRecv.dwTimeout = 5000;
- for (;;) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM) & packetRecv);
- if (recvResult == 0) {
- debugLogA("Connection Closed: No Error? during Connection Authorization");
- break;
- }
- else if (recvResult < 0) {
- debugLogA("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError());
- break;
- }
- else {
- unsigned short flap_length=0;
- for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed = flap_length) {
- if (!packetRecv.buffer)
- break;
-
- FLAP flap((char*)&packetRecv.buffer[packetRecv.bytesUsed],(unsigned short)(packetRecv.bytesAvailable-packetRecv.bytesUsed));
- if (!flap.len())
- break;
-
- flap_length+=FLAP_SIZE+flap.len();
- if (flap.cmp(0x01)) {
- if (aim_send_connection_packet(hServerConn, seqno,flap.val())==0)//cookie challenge
- aim_authkey_request(hServerConn, seqno);//md5 authkey request
- }
- else if (flap.cmp(0x02)) {
- SNAC snac(flap.val(),flap.snaclen());
- if (snac.cmp(0x0017)) {
- snac_md5_authkey(snac,hServerConn,seqno, username, password);
- int authres = snac_authorization_reply(snac);
- switch (authres) {
- case 1:
- mir_free(password);
- Netlib_CloseHandle(hServerPacketRecver);
- debugLogA("Connection Authorization Thread Ending: Negotiation Beginning");
- return;
-
- case 2:
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
- goto exit;
-
- case 3:
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
- goto exit;
+ if (m_iDesiredStatus != ID_STATUS_OFFLINE) {
+ char *password = getStringA(AIM_KEY_PW);
+ if (password != NULL) {
+ mir_free(username);
+ username = getStringA(AIM_KEY_SN);
+ if (username != NULL) {
+ HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 2048 * 4);
+ NETLIBPACKETRECVER packetRecv = {0};
+ packetRecv.cbSize = sizeof(packetRecv);
+ packetRecv.dwTimeout = 5000;
+ for (;;) {
+ int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM) & packetRecv);
+ if (recvResult == 0) {
+ debugLogA("Connection Closed: No Error? during Connection Authorization");
+ break;
+ }
+ else if (recvResult < 0) {
+ debugLogA("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError());
+ break;
+ }
+ else {
+ unsigned short flap_length=0;
+ for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed = flap_length) {
+ if (!packetRecv.buffer)
+ break;
+
+ FLAP flap((char*)&packetRecv.buffer[packetRecv.bytesUsed],(unsigned short)(packetRecv.bytesAvailable-packetRecv.bytesUsed));
+ if (!flap.len())
+ break;
+
+ flap_length+=FLAP_SIZE+flap.len();
+ if (flap.cmp(0x01)) {
+ if (aim_send_connection_packet(hServerConn, seqno,flap.val())==0)//cookie challenge
+ aim_authkey_request(hServerConn, seqno);//md5 authkey request
+ }
+ else if (flap.cmp(0x02)) {
+ SNAC snac(flap.val(),flap.snaclen());
+ if (snac.cmp(0x0017)) {
+ snac_md5_authkey(snac,hServerConn,seqno, username, password);
+ int authres = snac_authorization_reply(snac);
+ switch (authres) {
+ case 1:
+ mir_free(password);
+ Netlib_CloseHandle(hServerPacketRecver);
+ debugLogA("Connection Authorization Thread Ending: Negotiation Beginning");
+ return;
+
+ case 2:
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
+ goto exit;
+
+ case 3:
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
+ goto exit;
+ }
+ }
+ }
+ else if (flap.cmp(0x04)) {
+ debugLogA("Connection Authorization Thread Ending: Flap 0x04");
+ goto exit;
+ }
}
}
}
- else if (flap.cmp(0x04)) {
- debugLogA("Connection Authorization Thread Ending: Flap 0x04");
- goto exit;
- }
+exit:
+ if (hServerPacketRecver)
+ Netlib_CloseHandle(hServerPacketRecver);
}
}
+ mir_free(password);
}
-
-exit:
- mir_free(password);
- if (m_iStatus!=ID_STATUS_OFFLINE) broadcast_status(ID_STATUS_OFFLINE);
- if (hServerPacketRecver) Netlib_CloseHandle(hServerPacketRecver);
- Netlib_CloseHandle(hServerConn); hServerConn=NULL;
+ if (m_iStatus!=ID_STATUS_OFFLINE)
+ broadcast_status(ID_STATUS_OFFLINE);
+ Netlib_CloseHandle(hServerConn);
+ hServerConn=NULL;
debugLogA("Connection Authorization Thread Ending: End of Thread");
}
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 9256800a9d..c7f3e75407 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -911,7 +911,7 @@ void CAimProto::modify_ssi_list(SNAC &snac, int &offset)
if (tlv.cmp(0x00d5) && tlv.len() > 2)
{
- unsigned char type = tlv.ubyte(0);
+// unsigned char type = tlv.ubyte(0);
if (name_length == 1)
{
mir_free(hash_sm);
@@ -1436,7 +1436,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004
{
int sn_len = snac.ubyte(10);
char* sn = snac.part(11, sn_len);
- int reason = snac.ushort(11 + sn_len);
+// int reason = snac.ushort(11 + sn_len);
MCONTACT hContact = contact_from_sn(sn);
msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param));
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index e38ebfe9b6..bef02edf15 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -71,7 +71,7 @@ void DrawMyControl(HDC hDC, HWND /*hwndButton*/, HANDLE hTheme, UINT iState, REC
}
else // ...else draw non pressed button
{
- UINT uState = DFCS_BUTTONPUSH|(bIsPressed? DFCS_PUSHED : 0);
+ UINT uState = DFCS_BUTTONPUSH;
DrawFrameControl(hDC, &rect, DFC_BUTTON, uState);
}
}
@@ -919,7 +919,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//PN
int port = GetDlgItemInt(hwndDlg, IDC_PN, NULL, FALSE);
- if (port > 0 && port != ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_PORT : AIM_DEFAULT_SSL_PORT)
+ if (port > 0 && port != (ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_PORT : AIM_DEFAULT_SSL_PORT))
ppro->setWord(AIM_KEY_PN, (WORD)port);
else
ppro->delSetting(AIM_KEY_PN);
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 499ab43c8a..67a9e26c69 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -439,7 +439,7 @@ void CAimProto::set_local_nick(MCONTACT hContact, char* nick, char* note)
unsigned short buddy_id = getBuddyId(hContact, i);
if (buddy_id == 0) break;
- aim_mod_buddy(hServerConn, seqno, dbv.pszVal, group_id, buddy_id, nick, note);
+ aim_mod_buddy(hServerConn, seqno, dbv.pszVal, buddy_id, group_id, nick, note);
}
db_free(&dbv);
}