summaryrefslogtreecommitdiff
path: root/protocols/AimOscar/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-11 14:01:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-11 14:01:25 +0000
commit773421e8ba17637d994088c393d406226b516a30 (patch)
tree130c0bf529e30f493ae4f2abbe1230d31fecdeed /protocols/AimOscar/src
parent3fc8b6f686262e8a595fc10b2bd947526ca77bdc (diff)
- m_hNetlibUser moved to PROTO_INTERFACE;
- unified protocol loggers git-svn-id: http://svn.miranda-ng.org/main/trunk@6435 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/AimOscar/src')
-rw-r--r--protocols/AimOscar/src/avatars.cpp6
-rw-r--r--protocols/AimOscar/src/client.cpp6
-rw-r--r--protocols/AimOscar/src/connection.cpp53
-rw-r--r--protocols/AimOscar/src/direct_connect.cpp4
-rw-r--r--protocols/AimOscar/src/file.cpp26
-rw-r--r--protocols/AimOscar/src/popup.cpp4
-rw-r--r--protocols/AimOscar/src/proto.cpp16
-rw-r--r--protocols/AimOscar/src/proto.h3
-rw-r--r--protocols/AimOscar/src/proxy.cpp2
-rw-r--r--protocols/AimOscar/src/server.cpp54
-rw-r--r--protocols/AimOscar/src/thread.cpp8
-rw-r--r--protocols/AimOscar/src/utility.cpp18
12 files changed, 92 insertions, 108 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index f0bd5d9480..6e764e8b78 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -23,7 +23,7 @@ void __cdecl CAimProto::avatar_request_thread(void* param)
HANDLE hContact = (HANDLE)param;
char *sn = getStringA(hContact, AIM_KEY_SN);
- LOG("Starting avatar request thread for %s)", sn);
+ debugLogA("Starting avatar request thread for %s)", sn);
if (wait_conn(hAvatarConn, hAvatarEvent, 0x10))
{
@@ -33,7 +33,7 @@ void __cdecl CAimProto::avatar_request_thread(void* param)
size_t len = (strlen(hash_str) + 1) / 2;
char* hash = (char*)alloca(len);
string_to_bytes(hash_str, hash);
- LOG("Requesting an Avatar: %s (Hash: %s)", sn, hash_str);
+ debugLogA("Requesting an Avatar: %s (Hash: %s)", sn, hash_str);
aim_request_avatar(hAvatarConn, avatar_seqno, sn, type, hash, (unsigned short)len);
mir_free(hash_str);
@@ -118,7 +118,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const
mir_free(my_sn);
}
}
- else LOG("AIM sent avatar of zero length for %s.(Usually caused by repeated request for the same icon)", sn);
+ else debugLogA("AIM sent avatar of zero length for %s.(Usually caused by repeated request for the same icon)", sn);
ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &AI, 0);
}
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp
index c7d4bf04b7..8c725810a5 100644
--- a/protocols/AimOscar/src/client.cpp
+++ b/protocols/AimOscar/src/client.cpp
@@ -600,7 +600,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno,
aim_writetlv(0x2712,8,enc,frag_offset,msg_frag); // character set used by data
// aim_writetlvlong64(0x2713,ft->pfts.totalBytes,frag_offset,msg_frag); // file length
- LOG("Attempting to Send a file to a buddy.");
+ debugLogA("Attempting to Send a file to a buddy.");
}
else
{
@@ -620,7 +620,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno,
char cip[20];
long_ip_to_char_ip(ip, cip);
- LOG("IP for Buddy to connect to: %s:%u", cip, port);
+ debugLogA("IP for Buddy to connect to: %s:%u", cip, port);
return aim_sendflap(hServerConn,0x02,offset,buf,seqno)==0;
}
@@ -647,7 +647,7 @@ int CAimProto::aim_file_ad(HANDLE hServerConn,unsigned short &seqno,char* sn, ch
aim_writegeneric(sn_length,sn,offset,buf); // screen name
aim_writetlv(0x05,frag_offset,msg_frag,offset,buf); // icbm tags
- LOG("%s a file transfer.", deny ? "Denying" : "Accepting");
+ debugLogA("%s a file transfer.", deny ? "Denying" : "Accepting");
return aim_sendflap(hServerConn,0x02,offset,buf,seqno)==0;
}
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index 327274dac4..fcff93ef09 100644
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -18,18 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aim.h"
-int CAimProto::LOG(const char *fmt, ...)
-{
- va_list va;
- char szText[1024];
- if (!hNetlib)
- return 0;
- va_start(va, fmt);
- mir_vsnprintf(szText, sizeof(szText), fmt, va);
- va_end(va);
- return CallService(MS_NETLIB_LOG, (WPARAM) hNetlib, (LPARAM) szText);
-}
-
HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host)
{
NETLIBOPENCONNECTION ncon = { 0 };
@@ -38,15 +26,13 @@ HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_
ncon.wPort = port;
ncon.timeout = 6;
ncon.flags = NLOCF_V2;
- LOG("%s:%u", server, port);
- HANDLE con = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlib, (LPARAM)&ncon);
- if (con && use_ssl)
- {
+ debugLogA("%s:%u", server, port);
+ HANDLE con = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon);
+ if (con && use_ssl) {
NETLIBSSL ssl = {0};
ssl.cbSize = sizeof(ssl);
ssl.host = host;
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)con, (LPARAM)&ssl))
- {
+ if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)con, (LPARAM)&ssl)) {
Netlib_CloseHandle(con);
con = NULL;
}
@@ -62,8 +48,7 @@ HANDLE CAimProto::aim_peer_connect(const char* ip, unsigned short port)
ncon.szHost = ip;
ncon.wPort = port;
ncon.timeout = 3;
- HANDLE con = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) hNetlibPeer, (LPARAM) & ncon);
- return con;
+ return (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibPeer, (LPARAM)&ncon);
}
HANDLE CAimProto::aim_peer_connect(unsigned long ip, unsigned short port)
@@ -107,12 +92,12 @@ void CAimProto::aim_connection_authorization(void)
int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM) & packetRecv);
if (recvResult == 0)
{
- LOG("Connection Closed: No Error? during Connection Authorization");
+ debugLogA("Connection Closed: No Error? during Connection Authorization");
break;
}
else if (recvResult < 0)
{
- LOG("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError());
+ debugLogA("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError());
break;
}
else
@@ -143,7 +128,7 @@ void CAimProto::aim_connection_authorization(void)
case 1:
mir_free(password);
Netlib_CloseHandle(hServerPacketRecver);
- LOG("Connection Authorization Thread Ending: Negotiation Beginning");
+ debugLogA("Connection Authorization Thread Ending: Negotiation Beginning");
return;
case 2:
@@ -158,7 +143,7 @@ void CAimProto::aim_connection_authorization(void)
}
else if (flap.cmp(0x04))
{
- LOG("Connection Authorization Thread Ending: Flap 0x04");
+ debugLogA("Connection Authorization Thread Ending: Flap 0x04");
goto exit;
}
}
@@ -170,7 +155,7 @@ exit:
if (m_iStatus!=ID_STATUS_OFFLINE) broadcast_status(ID_STATUS_OFFLINE);
if (hServerPacketRecver) Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(hServerConn); hServerConn=NULL;
- LOG("Connection Authorization Thread Ending: End of Thread");
+ debugLogA("Connection Authorization Thread Ending: End of Thread");
}
void __cdecl CAimProto::aim_protocol_negotiation( void* )
@@ -185,7 +170,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
if (recvResult == 0)
{
- LOG("Connection Closed: No Error during Connection Negotiation?");
+ debugLogA("Connection Closed: No Error during Connection Negotiation?");
break;
}
else if (recvResult == SOCKET_ERROR)
@@ -197,7 +182,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
}
else
{
- LOG("Connection Closed: Socket Error during Connection Negotiation %d", WSAGetLastError());
+ debugLogA("Connection Closed: Socket Error during Connection Negotiation %d", WSAGetLastError());
break;
}
}
@@ -272,7 +257,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
else if (flap.cmp(0x04))
{
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
- LOG("Connection Negotiation Thread Ending: Flap 0x04");
+ debugLogA("Connection Negotiation Thread Ending: Flap 0x04");
goto exit;
}
}
@@ -283,7 +268,7 @@ exit:
if (m_iStatus!=ID_STATUS_OFFLINE) broadcast_status(ID_STATUS_OFFLINE);
Netlib_CloseHandle(hServerPacketRecver); hServerPacketRecver=NULL;
Netlib_CloseHandle(hServerConn); hServerConn=NULL;
- LOG("Connection Negotiation Thread Ending: End of Thread");
+ debugLogA("Connection Negotiation Thread Ending: End of Thread");
offline_contacts();
}
@@ -351,7 +336,7 @@ void __cdecl CAimProto::aim_mail_negotiation( void* )
}
exit:
- LOG("Mail Server Connection has ended");
+ debugLogA("Mail Server Connection has ended");
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(hMailConn);
hMailConn=NULL;
@@ -418,7 +403,7 @@ exit:
Netlib_CloseHandle(hAvatarConn);
hAvatarConn=NULL;
ResetEvent(hAvatarEvent);
- LOG("Avatar Server Connection has ended");
+ debugLogA("Avatar Server Connection has ended");
}
void __cdecl CAimProto::aim_chatnav_negotiation( void* )
@@ -496,7 +481,7 @@ exit:
Netlib_CloseHandle(hChatNavConn);
hChatNavConn=NULL;
ResetEvent(hChatNavEvent);
- LOG("Chat Navigation Server Connection has ended");
+ debugLogA("Chat Navigation Server Connection has ended");
}
void __cdecl CAimProto::aim_chat_negotiation( void* param )
@@ -571,7 +556,7 @@ exit:
Netlib_CloseHandle(item->hconn);
chat_leave(item->id);
remove_chat_by_ptr(item);
- LOG("Chat Server Connection has ended");
+ debugLogA("Chat Server Connection has ended");
}
void __cdecl CAimProto::aim_admin_negotiation( void* )
@@ -636,5 +621,5 @@ exit:
Netlib_CloseHandle(hAdminConn);
hAdminConn=NULL;
ResetEvent(hAdminEvent);
- LOG("Admin Server Connection has ended");
+ debugLogA("Admin Server Connection has ended");
}
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp
index f6d996ea37..982d56fe7d 100644
--- a/protocols/AimOscar/src/direct_connect.cpp
+++ b/protocols/AimOscar/src/direct_connect.cpp
@@ -52,7 +52,7 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini
HANDLE hConn = aim_peer_connect(AIM_PROXY_SERVER, get_default_port());
if (hConn)
{
- LOG("Connected to proxy ip because we want to use a proxy for the file transfer.");
+ debugLogA("Connected to proxy ip because we want to use a proxy for the file transfer.");
ft->requester = true;
ft->hConn = hConn;
ForkThread(&CAimProto::aim_proxy_helper, ft);
@@ -74,7 +74,7 @@ void aim_direct_connection_initiated(HANDLE hNewConnection, DWORD, void* extra)/
NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hNewConnection, (LPARAM)&connInfo);
- ppro->LOG("Buddy connected: %s", connInfo.szIpPort);
+ ppro->debugLogA("Buddy connected: %s", connInfo.szIpPort);
// okay someone connected to us or we initiated the connection- we need to figure out who they are and if they belong
ft = ppro->ft_list.find_by_port(connInfo.wPort);
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp
index 8cb4dcc4ca..ae5f3b8698 100644
--- a/protocols/AimOscar/src/file.cpp
+++ b/protocols/AimOscar/src/file.cpp
@@ -143,14 +143,14 @@ bool setup_next_file_send(file_transfer *ft)
int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv)
{
- LOG("P2P: Entered file sending thread.");
+ debugLogA("P2P: Entered file sending thread.");
bool failed = true;
bool failed_conn = false;
if (!setup_next_file_send(ft)) return 2;
- LOG("Sent file information to buddy.");
+ debugLogA("Sent file information to buddy.");
//start listen for packets stuff
for (;;)
@@ -160,13 +160,13 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
if (recvResult == 0)
{
- LOG("P2P: File transfer connection Error: 0");
+ debugLogA("P2P: File transfer connection Error: 0");
break;
}
if (recvResult == SOCKET_ERROR)
{
failed_conn = true;
- LOG("P2P: File transfer connection Error: -1");
+ debugLogA("P2P: File transfer connection Error: -1");
break;
}
if (recvResult > 0)
@@ -182,7 +182,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
unsigned short type = _htons(recv_ft->type);
if (type == 0x0202 || type == 0x0207)
{
- LOG("P2P: Buddy Accepts our file transfer.");
+ debugLogA("P2P: Buddy Accepts our file transfer.");
int fid = _topen(ft->pfts.tszCurrentFile, _O_RDONLY | _O_BINARY, _S_IREAD);
if (fid < 0)
@@ -219,7 +219,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
}
}
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->pfts);
- LOG("P2P: Finished sending file bytes.");
+ debugLogA("P2P: Finished sending file bytes.");
_close(fid);
}
else if (type == 0x0204)
@@ -230,7 +230,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
ft->pfts.totalProgress += ft->pfts.currentFileSize;
}
- LOG("P2P: Buddy says they got the file successfully");
+ debugLogA("P2P: Buddy says they got the file successfully");
if ((ft->pfts.currentFileNumber + 1) < ft->pfts.totalFiles)
{
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
@@ -260,7 +260,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
recv_ft->recv_bytes = 0;
}
- LOG("P2P: Buddy wants us to start sending at a specified file point. (%I64u)", ft->pfts.currentFileProgress);
+ debugLogA("P2P: Buddy wants us to start sending at a specified file point. (%I64u)", ft->pfts.currentFileProgress);
if (Netlib_Send(ft->hConn, (char*)recv_ft, _htons(recv_ft->length), 0) <= 0) break;
ft->pfts.totalProgress += ft->pfts.currentFileProgress;
@@ -275,7 +275,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv)
{
- LOG("P2P: Entered file receiving thread.");
+ debugLogA("P2P: Entered file receiving thread.");
bool failed = true;
bool failed_conn = false;
bool accepted_file = false;
@@ -293,13 +293,13 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET
recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
if (recvResult == 0)
{
- LOG("P2P: File transfer connection Error: 0");
+ debugLogA("P2P: File transfer connection Error: 0");
break;
}
if (recvResult == SOCKET_ERROR)
{
failed_conn = true;
- LOG("P2P: File transfer connection Error: -1");
+ debugLogA("P2P: File transfer connection Error: -1");
break;
}
if (recvResult > 0)
@@ -317,7 +317,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET
unsigned short type = _htons(recv_ft->type);
if (type == 0x0101)
{
- LOG("P2P: Buddy Ready to begin transfer.");
+ debugLogA("P2P: Buddy Ready to begin transfer.");
oft = (oft2*)mir_realloc(oft, pkt_len);
memcpy(oft, recv_ft, pkt_len);
memcpy(oft->icbm_cookie, ft->icbm_cookie, 8);
@@ -444,7 +444,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET
oft->recv_bytes = _htonl(ft->pfts.currentFileProgress);
oft->recv_checksum = _htonl(aim_oft_checksum_file(ft->pfts.tszCurrentFile));
- LOG("P2P: We got the file successfully");
+ debugLogA("P2P: We got the file successfully");
Netlib_Send(ft->hConn, (char*)oft, _htons(oft->length), 0);
if (_htons(oft->num_files_left) == 1)
{
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp
index 2d9489c5ac..107908da51 100644
--- a/protocols/AimOscar/src/popup.cpp
+++ b/protocols/AimOscar/src/popup.cpp
@@ -72,11 +72,11 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url)
if (flags & TCHAR_POPUP)
{
char* errmsg = mir_t2a((TCHAR*)msg);
- LOG(errmsg);
+ debugLogA(errmsg);
mir_free(errmsg);
}
else
- LOG(msg);
+ debugLogA(msg);
}
TCHAR *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((TCHAR*)msg) : mir_a2t(msg);
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp
index 61f1e8cdf5..a18ca749d0 100644
--- a/protocols/AimOscar/src/proto.cpp
+++ b/protocols/AimOscar/src/proto.cpp
@@ -21,7 +21,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) :
PROTO<CAimProto>(aProtoName, aUserName),
chat_rooms(5)
{
- LOG("Setting protocol/module name to '%s'", m_szModuleName);
+ debugLogA("Setting protocol/module name to '%s'", m_szModuleName);
//create some events
hAvatarEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -57,7 +57,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) :
nlu.szSettingsModule = m_szModuleName;
mir_sntprintf(descr, SIZEOF(descr), TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
- hNetlib = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2P[128];
mir_snprintf(szP2P, sizeof(szP2P), "%sP2P", m_szModuleName);
@@ -84,7 +84,7 @@ CAimProto::~CAimProto()
close_chat_conn();
- Netlib_CloseHandle(hNetlib);
+ Netlib_CloseHandle(m_hNetlibUser);
Netlib_CloseHandle(hNetlibPeer);
DeleteCriticalSection(&SendingMutex);
@@ -231,7 +231,7 @@ int __cdecl CAimProto::FileCancel(HANDLE hContact, HANDLE hTransfer)
file_transfer *ft = (file_transfer*)hTransfer;
if (!ft_list.find_by_ft(ft)) return 0;
- LOG("We are cancelling a file transfer.");
+ debugLogA("We are cancelling a file transfer.");
aim_chat_deny(hServerConn, seqno, ft->sn, ft->icbm_cookie);
@@ -254,7 +254,7 @@ int __cdecl CAimProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCH
file_transfer *ft = (file_transfer*)hTransfer;
if (!ft_list.find_by_ft(ft)) return 0;
- LOG("We are denying a file transfer.");
+ debugLogA("We are denying a file transfer.");
aim_chat_deny(hServerConn, seqno, ft->sn, ft->icbm_cookie);
return 0;
@@ -445,10 +445,10 @@ int __cdecl CAimProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre)
char *bbuf = NULL;
if (getByte(AIM_KEY_FI, 1))
{
- LOG("Converting from html to bbcodes then stripping leftover html.");
+ debugLogA("Converting from html to bbcodes then stripping leftover html.");
pre->szMessage = bbuf = html_to_bbcodes(pre->szMessage);
}
- LOG("Stripping html.");
+ debugLogA("Stripping html.");
html_decode(pre->szMessage);
INT_PTR res = Proto_RecvMessage(hContact, pre);
@@ -525,7 +525,7 @@ HANDLE __cdecl CAimProto::SendFile(HANDLE hContact, const PROTOCHAR* szDescripti
if (ft->me_force_proxy)
{
- LOG("We are forcing a proxy file transfer.");
+ debugLogA("We are forcing a proxy file transfer.");
ForkThread(&CAimProto::accept_file_thread, ft);
}
else
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h
index e7460fbe8c..041a78694c 100644
--- a/protocols/AimOscar/src/proto.h
+++ b/protocols/AimOscar/src/proto.h
@@ -139,7 +139,7 @@ struct CAimProto : public PROTO<CAimProto>
//Some main connection stuff
HANDLE hServerConn;//handle to the main connection
- HANDLE hNetlib;//handle to netlib
+
unsigned long internal_ip; // our ip
unsigned long detected_ip; // our ip
unsigned short local_port; // our port
@@ -318,7 +318,6 @@ struct CAimProto : public PROTO<CAimProto>
void __cdecl aim_chat_negotiation( void* );
void __cdecl aim_admin_negotiation( void* );
- int LOG(const char *fmt, ...);
HANDLE aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host = NULL);
HANDLE aim_peer_connect(const char* ip, unsigned short port);
HANDLE aim_peer_connect(unsigned long ip, unsigned short port);
diff --git a/protocols/AimOscar/src/proxy.cpp b/protocols/AimOscar/src/proxy.cpp
index f3cc734127..d24f34f8f2 100644
--- a/protocols/AimOscar/src/proxy.cpp
+++ b/protocols/AimOscar/src/proxy.cpp
@@ -90,7 +90,7 @@ void __cdecl CAimProto::aim_proxy_helper(void* param)
unsigned long ip = _htonl(*(unsigned long*)&packetRecv.buffer[14]);
aim_send_file(hServerConn, seqno, ip, port, true, ft);
- LOG("Stage %d Proxy ft and we are not the sender.", ft->req_num);
+ debugLogA("Stage %d Proxy ft and we are not the sender.", ft->req_num);
}
else if (type == 0x0005)
{
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 3988e342fa..a81b8e2ed6 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -1029,7 +1029,7 @@ void CAimProto::snac_contact_list(SNAC &snac,HANDLE hServerConn,unsigned short &
{
if (snac.subcmp(0x0006)) //contact list
{
- LOG("Contact List Received");
+ debugLogA("Contact List Received");
// unsigned char ver = snac.ubyte();
int num_obj = snac.ushort(1);
@@ -1064,7 +1064,7 @@ void CAimProto::snac_contact_list(SNAC &snac,HANDLE hServerConn,unsigned short &
avatar_request_handler(NULL, NULL, 0);
- LOG("Connection Negotiation Finished");
+ debugLogA("Connection Negotiation Finished");
state = 1;
}
}
@@ -1356,8 +1356,8 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
{
if (rdz_msg_type == 0 && request_num == 1) //buddy wants to send us a file
{
- LOG("Buddy Wants to Send us a file. Request 1");
- LOG(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
+ debugLogA("Buddy Wants to Send us a file. Request 1");
+ debugLogA(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
file_transfer* ft = new file_transfer(hContact, sn, icbm_cookie);
@@ -1394,14 +1394,14 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
mir_free(filenameT);
char cip[20];
- LOG("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
- LOG("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
- LOG("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
+ debugLogA("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
+ debugLogA("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
+ debugLogA("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
}
else if (rdz_msg_type == 0)
{
- LOG("We are sending a file. Buddy wants us to connect to them. Request %d", request_num);
- LOG(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
+ debugLogA("We are sending a file. Buddy wants us to connect to them. Request %d", request_num);
+ debugLogA(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
file_transfer* ft = ft_list.find_by_cookie(icbm_cookie, hContact);
if (ft)
@@ -1419,21 +1419,21 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
ft->max_ver = max_ver;
char cip[20];
- LOG("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
- LOG("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
- LOG("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
+ debugLogA("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
+ debugLogA("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
+ debugLogA("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
ForkThread(&CAimProto::accept_file_thread, ft);
}
else
{
- LOG("Unknown File transfer, thus denied.");
+ debugLogA("Unknown File transfer, thus denied.");
aim_file_ad(hServerConn, seqno, sn, icbm_cookie, true, 0);
}
}
else if (rdz_msg_type == 1)//buddy cancelled or denied file transfer
{
- LOG("File transfer cancelled or denied.");
+ debugLogA("File transfer cancelled or denied.");
file_transfer* ft = ft_list.find_by_cookie(icbm_cookie, hContact);
ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_DENIED, ft, 0);
@@ -1441,7 +1441,7 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
}
else if (rdz_msg_type == 2)//buddy accepts our file transfer request
{
- LOG("File transfer accepted");
+ debugLogA("File transfer accepted");
file_transfer* ft = ft_list.find_by_cookie(icbm_cookie, hContact);
if (ft)
{
@@ -1495,7 +1495,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004
int error = snac.ushort(13 + sn_len);
if (error == 0x02)
{
- LOG("File Transfer declied");
+ debugLogA("File Transfer declied");
HANDLE hContact = contact_from_sn(sn);
file_transfer *ft = ft_list.find_by_cookie(icbm_cookie, hContact);
if (ft)
@@ -1733,39 +1733,39 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
hMailConn = aim_connect(server, get_default_port(), false/*use_ssl != 0*/, host);
if (hMailConn)
{
- LOG("Successfully Connected to the Mail Server.");
+ debugLogA("Successfully Connected to the Mail Server.");
MAIL_COOKIE=local_cookie;
MAIL_COOKIE_LENGTH=local_cookie_length;
ForkThread( &CAimProto::aim_mail_negotiation, 0 );
}
else
- LOG("Failed to connect to the Mail Server.");
+ debugLogA("Failed to connect to the Mail Server.");
}
else if (family == 0x0010)
{
hAvatarConn = aim_connect(server, get_default_port(), false/*use_ssl != 0*/);
if (hAvatarConn)
{
- LOG("Successfully Connected to the Avatar Server.");
+ debugLogA("Successfully Connected to the Avatar Server.");
AVATAR_COOKIE = local_cookie;
AVATAR_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_avatar_negotiation, 0 );
}
else
- LOG("Failed to connect to the Avatar Server.");
+ debugLogA("Failed to connect to the Avatar Server.");
}
else if (family == 0x000D)
{
hChatNavConn = aim_connect(server, get_default_port(), use_ssl != 0, host);
if (hChatNavConn)
{
- LOG("Successfully Connected to the Chat Navigation Server.");
+ debugLogA("Successfully Connected to the Chat Navigation Server.");
CHATNAV_COOKIE = local_cookie;
CHATNAV_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_chatnav_negotiation, 0 );
}
else
- LOG("Failed to connect to the Chat Navigation Server.");
+ debugLogA("Failed to connect to the Chat Navigation Server.");
}
else if (family == 0x000E)
@@ -1776,14 +1776,14 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
item->hconn = aim_connect(server, get_default_port(), use_ssl != 0, host);
if (item->hconn)
{
- LOG("Successfully Connected to the Chat Server.");
+ debugLogA("Successfully Connected to the Chat Server.");
chat_start(item->id, item->exchange);
item->CHAT_COOKIE = local_cookie;
item->CHAT_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_chat_negotiation, item );
}
else
- LOG("Failed to connect to the Chat Server.");
+ debugLogA("Failed to connect to the Chat Server.");
}
}
else if (family == 0x0007)
@@ -1791,13 +1791,13 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
hAdminConn = aim_connect(server, get_default_port(), false /*use_ssl != 0*/);
if (hAdminConn)
{
- LOG("Successfully Connected to the Admin Server.");
+ debugLogA("Successfully Connected to the Admin Server.");
ADMIN_COOKIE = local_cookie;
ADMIN_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_admin_negotiation, 0 );
}
else
- LOG("Failed to connect to the Admin Server.");
+ debugLogA("Failed to connect to the Admin Server.");
}
mir_free(server);
mir_free(host);
@@ -1946,7 +1946,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac,HANDLE hServerConn,unsigne
{
if (snac.subcmp(0x0009))
{
- LOG("Chat Info Received");
+ debugLogA("Chat Info Received");
unsigned short offset_info=0;
while (offset_info < snac.len()) // Loop through all the TLVs and pull out the buddy name
diff --git a/protocols/AimOscar/src/thread.cpp b/protocols/AimOscar/src/thread.cpp
index 60f16f5263..04b0991333 100644
--- a/protocols/AimOscar/src/thread.cpp
+++ b/protocols/AimOscar/src/thread.cpp
@@ -28,7 +28,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file
hConn = aim_peer_connect(ft->proxy_ip, get_default_port());
if (hConn)
{
- LOG("Connected to proxy ip that buddy specified.");
+ debugLogA("Connected to proxy ip that buddy specified.");
ft->hConn = hConn;
ForkThread(&CAimProto::aim_proxy_helper, ft);
ft->stop_listen();
@@ -39,7 +39,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file
hConn = aim_peer_connect(AIM_PROXY_SERVER, get_default_port());
if (hConn)
{
- LOG("Connected to proxy ip because we want to use a proxy for the file transfer.");
+ debugLogA("Connected to proxy ip because we want to use a proxy for the file transfer.");
ft->requester = true;
ft->hConn = hConn;
ForkThread(&CAimProto::aim_proxy_helper, ft);
@@ -52,7 +52,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file
hConn = aim_peer_connect(verif ? ft->verified_ip : ft->local_ip, ft->port);
if (hConn)
{
- LOG("Connected to buddy over P2P port via %s ip.", verif ? "verified": "local");
+ debugLogA("Connected to buddy over P2P port via %s ip.", verif ? "verified": "local");
ft->accepted = true;
ft->hConn = hConn;
aim_file_ad(hServerConn, seqno, ft->sn, ft->icbm_cookie, false, ft->max_ver);
@@ -72,7 +72,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file
}
else
{
- LOG("Failed to connect to buddy- asking buddy to connect to us.");
+ debugLogA("Failed to connect to buddy- asking buddy to connect to us.");
ft->listen(this);
ft->requester = true;
aim_send_file(hServerConn, seqno, detected_ip, ft->local_port, false, ft);
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index a113ee191d..58ca76cb0e 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void CAimProto::broadcast_status(int status)
{
- LOG("Broadcast Status: %d",status);
+ debugLogA("Broadcast Status: %d",status);
int old_status = m_iStatus;
m_iStatus = status;
if (m_iStatus == ID_STATUS_OFFLINE)
@@ -139,7 +139,7 @@ bool CAimProto::wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service)
EnterCriticalSection(&connMutex);
if (hConn == NULL && hServerConn)
{
- LOG("Starting Connection.");
+ debugLogA("Starting Connection.");
hConn = (HANDLE)1; //set so no additional service request attempts are made while aim is still processing the request
aim_new_service_request(hServerConn, seqno, service) ;//general service connection!
}
@@ -200,7 +200,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora
if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) m_szModuleName) == 0) {
setString(hContact, AIM_KEY_SN, norm_sn);
setString(hContact, AIM_KEY_NK, sn);
- LOG("Adding contact %s to client side list.",norm_sn);
+ debugLogA("Adding contact %s to client side list.",norm_sn);
if (temporary)
db_set_b(hContact, "CList", "NotOnList", 1);
return hContact;
@@ -227,7 +227,7 @@ void CAimProto::update_server_group(const char* group, unsigned short group_id)
user_id_array[i] = _htons(group_list[i].item_id);
}
- LOG("Modifying group %s:%u on the serverside list",group, group_id);
+ debugLogA("Modifying group %s:%u on the serverside list",group, group_id);
aim_mod_group(hServerConn, seqno, group, group_id, (char*)user_id_array,
user_id_array_size * sizeof(unsigned short));
@@ -262,7 +262,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group)
unsigned short new_group_id = group_list.find_id(new_group);
if (!item_id)
- LOG("Contact %u not on list.", hContact);
+ debugLogA("Contact %u not on list.", hContact);
setGroupId(hContact, 1, new_group_id);
if (new_group && strcmp(new_group, AIM_DEFAULT_GROUP))
@@ -275,13 +275,13 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group)
if (new_group_id == 0)
{
create_group(new_group);
- LOG("Group %s not on list.", new_group);
+ debugLogA("Group %s not on list.", new_group);
new_group_id = group_list.add(new_group);
- LOG("Adding group %s:%u to the serverside list", new_group, new_group_id);
+ debugLogA("Adding group %s:%u to the serverside list", new_group, new_group_id);
aim_add_contact(hServerConn, seqno, new_group, 0, new_group_id, 1);//add the group server-side even if it exist
}
- LOG("Adding buddy %s:%u %s:%u to the serverside list", dbv.pszVal, new_item_id, new_group, new_group_id);
+ debugLogA("Adding buddy %s:%u %s:%u to the serverside list", dbv.pszVal, new_item_id, new_group, new_group_id);
aim_add_contact(hServerConn, seqno, dbv.pszVal, new_item_id, new_group_id, 0, nick);
update_server_group(new_group, new_group_id);
@@ -289,7 +289,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group)
if (old_group_id && item_id)
{
bool is_not_in_list = getBool(hContact, AIM_KEY_NIL, false);
- LOG("Removing buddy %s:%u %s:%u from the serverside list", dbv.pszVal, item_id, old_group, old_group_id);
+ debugLogA("Removing buddy %s:%u %s:%u from the serverside list", dbv.pszVal, item_id, old_group, old_group_id);
aim_delete_contact(hServerConn, seqno, dbv.pszVal, item_id, old_group_id, 0, is_not_in_list);
update_server_group(old_group, old_group_id);
delSetting(hContact, AIM_KEY_NIL);