summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_protomod.h17
-rw-r--r--plugins/Alarms/src/alarms.cpp6
-rw-r--r--plugins/FileAsMessage/src/main.cpp2
-rw-r--r--plugins/MetaContacts/src/meta_services.cpp10
-rw-r--r--plugins/MirOTR/MirOTR/src/utils.cpp18
-rw-r--r--protocols/AimOscar/src/avatars.cpp6
-rw-r--r--protocols/AimOscar/src/client.cpp4
-rw-r--r--protocols/AimOscar/src/connection.cpp72
-rw-r--r--protocols/AimOscar/src/conv.cpp56
-rw-r--r--protocols/AimOscar/src/flap.cpp6
-rw-r--r--protocols/AimOscar/src/proto.cpp8
-rw-r--r--protocols/AimOscar/src/server.cpp336
-rw-r--r--protocols/AimOscar/src/snac.cpp4
-rw-r--r--protocols/AimOscar/src/tlv.cpp2
-rw-r--r--protocols/AimOscar/src/ui.cpp42
-rw-r--r--protocols/AimOscar/src/utility.cpp4
-rw-r--r--protocols/EmLanProto/src/mlan.cpp47
-rw-r--r--protocols/FacebookRM/src/process.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp12
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp22
-rw-r--r--protocols/IRCG/src/irclib.cpp10
-rw-r--r--protocols/IcqOscarJ/src/fam_02location.cpp21
-rw-r--r--protocols/IcqOscarJ/src/fam_04message.cpp82
-rw-r--r--protocols/IcqOscarJ/src/fam_13servclist.cpp14
-rw-r--r--protocols/IcqOscarJ/src/icq_filerequests.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_xtraz.cpp23
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp8
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp3
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp4
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp7
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp9
-rw-r--r--protocols/MRA/src/Mra_proto.cpp62
-rw-r--r--protocols/MSN/src/msn_commands.cpp44
-rw-r--r--protocols/MSN/src/msn_mail.cpp7
-rw-r--r--protocols/MSN/src/msn_misc.cpp8
-rw-r--r--protocols/MSN/src/msn_p2p.cpp8
-rw-r--r--protocols/NewsAggregator/Src/Utils.cpp16
-rw-r--r--protocols/Tlen/src/jabber_thread.cpp22
-rw-r--r--protocols/Tlen/src/tlen_file.cpp3
-rw-r--r--protocols/Tlen/src/tlen_p2p_new.cpp3
-rw-r--r--protocols/Twitter/src/connection.cpp9
-rw-r--r--protocols/Xfire/src/main.cpp42
-rw-r--r--protocols/Xfire/src/variables.cpp2
-rw-r--r--protocols/Yahoo/src/file_transfer.cpp16
-rw-r--r--protocols/Yahoo/src/im.cpp10
-rw-r--r--protocols/Yahoo/src/yahoo.cpp92
48 files changed, 430 insertions, 806 deletions
diff --git a/include/m_protomod.h b/include/m_protomod.h
index 13dd93e5fb..d8d364b987 100644
--- a/include/m_protomod.h
+++ b/include/m_protomod.h
@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include "m_protocols.h"
+#include "m_protosvc.h"
//notify the protocol manager that you're around
//wParam = 0
@@ -99,6 +100,21 @@ __forceinline HANDLE CreateProtoServiceFunction(const char *szModule, const char
//differences between threads the functions are in.
#define MS_PROTO_CHAINRECV "Proto/ChainRecv"
+__forceinline INT_PTR ProtoChainRecv(HANDLE hContact, char *szService, WPARAM wParam, LPARAM lParam)
+{ CCSDATA ccs = { hContact, szService, wParam, lParam };
+ return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+}
+
+__forceinline INT_PTR ProtoChainRecvMsg(HANDLE hContact, PROTORECVEVENT *pre)
+{ CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre };
+ return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+}
+
+__forceinline INT_PTR ProtoChainRecvFile(HANDLE hContact, PROTORECVFILET *pre)
+{ CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pre };
+ return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+}
+
//Broadcast a ME_PROTO_ACK event
//wParam = 0
//lParam = (LPARAM)(ACKDATA*)&ack
@@ -106,6 +122,7 @@ __forceinline HANDLE CreateProtoServiceFunction(const char *szModule, const char
//Thread safety: me_proto_ack is completely thread safe since 0.1.2.0
//See the notes in core/modules.h under NotifyEventHooks()
#define MS_PROTO_BROADCASTACK "Proto/BroadcastAck"
+
__forceinline INT_PTR ProtoBroadcastAck(const char *szModule, HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
ACKDATA ack = {0};
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp
index cc3164809c..aea3791a9c 100644
--- a/plugins/Alarms/src/alarms.cpp
+++ b/plugins/Alarms/src/alarms.cpp
@@ -123,12 +123,6 @@ static int PluginMessageReceived(WPARAM wParam,LPARAM lParam)
}
else mir_sntprintf(buff, SIZEOF(buff), _T("Unknown command issued: \"%s\""), msg);
- /*
- ppre->szMessage = (char *)Translate(buff);
- retval = CallService( MS_PROTO_CHAINRECV, wParam, lParam );
- ppre->szMessage = savedMsg;
- */
-
ShowPopup(pccsd->hContact, buff);
_tcscpy(response, buff);
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp
index 14a905a9b8..197e59309f 100644
--- a/plugins/FileAsMessage/src/main.cpp
+++ b/plugins/FileAsMessage/src/main.cpp
@@ -143,7 +143,7 @@ INT_PTR OnRecvMessage( WPARAM wParam, LPARAM lParam )
PROTORECVEVENT *ppre = ( PROTORECVEVENT * )pccsd->lParam;
if(strncmp(ppre->szMessage, szServicePrefix, strlen(szServicePrefix)))
- return CallService( MS_PROTO_CHAINRECV, wParam, lParam );
+ return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
HWND hwnd = WindowList_Find(hFileList, (HANDLE)pccsd->hContact);
if(!IsWindow(hwnd))
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp
index d48d187d85..c837a7b1c8 100644
--- a/plugins/MetaContacts/src/meta_services.cpp
+++ b/plugins/MetaContacts/src/meta_services.cpp
@@ -485,7 +485,6 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
*/
INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
{
- DBEVENTINFO dbei;
CCSDATA *ccs = (CCSDATA *) lParam;
PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
@@ -499,17 +498,14 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
// use the subcontact's protocol to add the db if possible (AIMOSCAR removes HTML here!)
HANDLE most_online = Meta_GetMostOnline(ccs->hContact);
char *proto = GetContactProto(most_online);
- if (proto) {
- char service[256];
- mir_snprintf(service, 256, "%s%s", proto, PSR_MESSAGE);
- if (CallService(service, wParam, lParam) != CALLSERVICE_NOTFOUND)
+ if (proto)
+ if ( CallProtoService(proto, PSR_MESSAGE, wParam, lParam) != CALLSERVICE_NOTFOUND)
return 0;
- }
}
// otherwise, add event to db directly
- ZeroMemory(&dbei, sizeof(dbei));
+ DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
dbei.szModule = META_PROTO;
dbei.timestamp = pre->timestamp;
diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp
index ea9b55b619..f15987716b 100644
--- a/plugins/MirOTR/MirOTR/src/utils.cpp
+++ b/plugins/MirOTR/MirOTR/src/utils.cpp
@@ -320,14 +320,8 @@ void ShowMessageInline(const HANDLE hContact, const TCHAR *msg) {
char *utf = mir_utf8encodeT(buff);
pre.szMessage = utf;
pre.flags = PREF_UTF|PREF_BYPASS_OTR;
- //CallContactService(hContact, PSR_MESSAGE, 0, (LPARAM)&pre);
+ ProtoChainRecvMsg(hContact, &pre);
- CCSDATA ccs = {0};
- ccs.hContact = hContact;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM)&pre;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
mir_free(utf);
}
@@ -339,17 +333,9 @@ void ShowMessageInlineUtf(const HANDLE hContact, const char *msg) {
pre.timestamp = time(0);
pre.szMessage = buff;
pre.flags = PREF_UTF|PREF_BYPASS_OTR;
- //CallContactService(hContact, PSR_MESSAGE, 0, (LPARAM)&pre);
-
- CCSDATA ccs = {0};
- ccs.hContact = hContact;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM)&pre;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
}
-
void ShowMessageUtf(const HANDLE hContact, const char *msg) {
if(options.msg_inline)
ShowMessageInlineUtf(hContact, msg);
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index 4c7de35f18..769c940cea 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -131,17 +131,17 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const
int detect_image_type(const char* stream, const TCHAR* &type_ret)
{
- if(stream[0]=='G'&&stream[1]=='I'&&stream[2]=='F')
+ if (stream[0]=='G'&&stream[1]=='I'&&stream[2]=='F')
{
type_ret = _T(".gif");
return PA_FORMAT_GIF;
}
- else if(stream[1]=='P'&&stream[2]=='N'&&stream[3]=='G')
+ else if (stream[1]=='P'&&stream[2]=='N'&&stream[3]=='G')
{
type_ret = _T(".png");
return PA_FORMAT_PNG;
}
- else if(stream[0]=='B'&&stream[1]=='M')
+ else if (stream[0]=='B'&&stream[1]=='M')
{
type_ret = _T(".bmp");
return PA_FORMAT_BMP;
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp
index 5c4421ac11..37fe6c2734 100644
--- a/protocols/AimOscar/src/client.cpp
+++ b/protocols/AimOscar/src/client.cpp
@@ -223,7 +223,7 @@ int CAimProto::aim_set_caps(HANDLE hServerConn,unsigned short &seqno)
// memcpy(&temp[AIM_CAPS_LENGTH*i++],AIM_CAP_ICQ_SERVER_RELAY,AIM_CAPS_LENGTH);
memcpy(&temp[AIM_CAPS_LENGTH*i++],AIM_CAP_UTF8,AIM_CAPS_LENGTH);
memcpy(&temp[AIM_CAPS_LENGTH*i++],AIM_CAP_MIRANDA,AIM_CAPS_LENGTH);
- if(getByte(AIM_KEY_HF, 0))
+ if (getByte(AIM_KEY_HF, 0))
memcpy(&temp[AIM_CAPS_LENGTH*i++],AIM_CAP_HIPTOP,AIM_CAPS_LENGTH);
aim_writesnac(0x02,0x04,offset,buf);
aim_writetlv(0x05,(unsigned short)(AIM_CAPS_LENGTH*i),temp,offset,buf);
@@ -370,7 +370,7 @@ int CAimProto::aim_send_message(HANDLE hServerConn,unsigned short &seqno,const c
if (!blast)
{
- if(auto_response)
+ if (auto_response)
aim_writetlv(0x04,0,0,offset,buf); // auto-response message
else
{
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index 81548f875b..3b98a8ae7c 100644
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -131,10 +131,10 @@ void CAimProto::aim_connection_authorization(void)
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))
+ else if (flap.cmp(0x02))
{
SNAC snac(flap.val(),flap.snaclen());
- if(snac.cmp(0x0017))
+ if (snac.cmp(0x0017))
{
snac_md5_authkey(snac,hServerConn,seqno, username, password);
int authres = snac_authorization_reply(snac);
@@ -156,7 +156,7 @@ void CAimProto::aim_connection_authorization(void)
}
}
}
- else if(flap.cmp(0x04))
+ else if (flap.cmp(0x04))
{
LOG("Connection Authorization Thread Ending: Flap 0x04");
goto exit;
@@ -201,7 +201,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
break;
}
}
- else if(recvResult>0)
+ else if (recvResult>0)
{
unsigned short flap_length=0;
for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed=flap_length)
@@ -212,17 +212,17 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
if (!flap.len())
break;
flap_length+=FLAP_SIZE+flap.len();
- if(flap.cmp(0x01))
+ if (flap.cmp(0x01))
{
aim_send_cookie(hServerConn,seqno,COOKIE_LENGTH,COOKIE);//cookie challenge
mir_free(COOKIE);
COOKIE=NULL;
COOKIE_LENGTH=0;
}
- else if(flap.cmp(0x02))
+ else if (flap.cmp(0x02))
{
SNAC snac(flap.val(),flap.snaclen());
- if(snac.cmp(0x0001))
+ if (snac.cmp(0x0001))
{
snac_supported_families(snac,hServerConn,seqno);
snac_supported_family_versions(snac,hServerConn,seqno);
@@ -231,18 +231,18 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
snac_self_info(snac);
snac_error(snac);
}
- else if(snac.cmp(0x0002))
+ else if (snac.cmp(0x0002))
{
snac_received_info(snac);
snac_error(snac);
}
- else if(snac.cmp(0x0003))
+ else if (snac.cmp(0x0003))
{
snac_user_online(snac);
snac_user_offline(snac);
snac_error(snac);
}
- else if(snac.cmp(0x0004))
+ else if (snac.cmp(0x0004))
{
snac_icbm_limitations(snac,hServerConn,seqno);
snac_message_accepted(snac);
@@ -251,7 +251,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
snac_error(snac);
snac_file_decline(snac);
}
- else if(snac.cmp(0x000A))
+ else if (snac.cmp(0x000A))
{
snac_email_search_results(snac);
/*
@@ -262,14 +262,14 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* )
*/
//snac_error(snac);
}
- else if(snac.cmp(0x0013))
+ else if (snac.cmp(0x0013))
{
snac_contact_list(snac,hServerConn,seqno);
snac_list_modification_ack(snac);
snac_error(snac);
}
}
- else if(flap.cmp(0x04))
+ else if (flap.cmp(0x04))
{
sendBroadcast(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
LOG("Connection Negotiation Thread Ending: Flap 0x04");
@@ -311,7 +311,7 @@ void __cdecl CAimProto::aim_mail_negotiation( void* )
else
break;
}
- if(recvResult>0)
+ if (recvResult>0)
{
unsigned short flap_length=0;
for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed=flap_length)
@@ -322,7 +322,7 @@ void __cdecl CAimProto::aim_mail_negotiation( void* )
if (!flap.len())
break;
flap_length+=FLAP_SIZE+flap.len();
- if(flap.cmp(0x01))
+ if (flap.cmp(0x01))
{
aim_send_cookie(hMailConn,mail_seqno,MAIL_COOKIE_LENGTH,MAIL_COOKIE);//cookie challenge
mir_free(MAIL_COOKIE);
@@ -344,7 +344,7 @@ void __cdecl CAimProto::aim_mail_negotiation( void* )
snac_mail_response(snac);
}
}
- else if(flap.cmp(0x04))
+ else if (flap.cmp(0x04))
goto exit;
}
}
@@ -384,14 +384,14 @@ void __cdecl CAimProto::aim_avatar_negotiation( void* )
if (!flap.len())
break;
flap_length += FLAP_SIZE + flap.len();
- if(flap.cmp(0x01))
+ if (flap.cmp(0x01))
{
aim_send_cookie(hAvatarConn, avatar_seqno, AVATAR_COOKIE_LENGTH, AVATAR_COOKIE);//cookie challenge
mir_free(AVATAR_COOKIE);
AVATAR_COOKIE = NULL;
AVATAR_COOKIE_LENGTH = 0;
}
- else if(flap.cmp(0x02))
+ else if (flap.cmp(0x02))
{
SNAC snac(flap.val(), flap.snaclen());
if (snac.cmp(0x0001))
@@ -451,7 +451,7 @@ void __cdecl CAimProto::aim_chatnav_negotiation( void* )
break;
}
- if(recvResult>0)
+ if (recvResult>0)
{
unsigned short flap_length=0;
for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed=flap_length)
@@ -462,30 +462,30 @@ void __cdecl CAimProto::aim_chatnav_negotiation( void* )
if (!flap.len())
break;
flap_length+=FLAP_SIZE+flap.len();
- if(flap.cmp(0x01))
+ if (flap.cmp(0x01))
{
aim_send_cookie(hChatNavConn,chatnav_seqno,CHATNAV_COOKIE_LENGTH,CHATNAV_COOKIE);//cookie challenge
mir_free(CHATNAV_COOKIE);
CHATNAV_COOKIE=NULL;
CHATNAV_COOKIE_LENGTH=0;
}
- else if(flap.cmp(0x02))
+ else if (flap.cmp(0x02))
{
SNAC snac(flap.val(),flap.snaclen());
- if(snac.cmp(0x0001))
+ if (snac.cmp(0x0001))
{
snac_supported_families(snac,hChatNavConn,chatnav_seqno);
snac_supported_family_versions(snac,hChatNavConn,chatnav_seqno);
snac_chatnav_rate_limitations(snac,hChatNavConn,chatnav_seqno);
snac_error(snac);
}
- if(snac.cmp(0x000D))
+ if (snac.cmp(0x000D))
{
snac_chatnav_info_response(snac,hChatNavConn,chatnav_seqno);
snac_error(snac);
}
}
- else if(flap.cmp(0x04))
+ else if (flap.cmp(0x04))
goto exit;
}
}
@@ -524,7 +524,7 @@ void __cdecl CAimProto::aim_chat_negotiation( void* param )
break;
}
- if(recvResult>0)
+ if (recvResult>0)
{
unsigned short flap_length=0;
for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed=flap_length)
@@ -535,17 +535,17 @@ void __cdecl CAimProto::aim_chat_negotiation( void* param )
if (!flap.len())
break;
flap_length+=FLAP_SIZE+flap.len();
- if(flap.cmp(0x01))
+ if (flap.cmp(0x01))
{
aim_send_cookie(item->hconn,item->seqno,item->CHAT_COOKIE_LENGTH,item->CHAT_COOKIE);//cookie challenge
mir_free(item->CHAT_COOKIE);
item->CHAT_COOKIE=NULL;
item->CHAT_COOKIE_LENGTH=0;
}
- else if(flap.cmp(0x02))
+ else if (flap.cmp(0x02))
{
SNAC snac(flap.val(),flap.snaclen());
- if(snac.cmp(0x0001))
+ if (snac.cmp(0x0001))
{
snac_supported_families(snac,item->hconn,item->seqno);
snac_supported_family_versions(snac,item->hconn,item->seqno);
@@ -553,14 +553,14 @@ void __cdecl CAimProto::aim_chat_negotiation( void* param )
snac_error(snac);
}
- if(snac.cmp(0x000E))
+ if (snac.cmp(0x000E))
{
snac_chat_received_message(snac, item);
snac_chat_joined_left_users(snac, item);
snac_error(snac);
}
}
- else if(flap.cmp(0x04))
+ else if (flap.cmp(0x04))
goto exit;
}
}
@@ -590,7 +590,7 @@ void __cdecl CAimProto::aim_admin_negotiation( void* )
if (recvResult == SOCKET_ERROR)
break;
- if(recvResult>0)
+ if (recvResult>0)
{
unsigned short flap_length=0;
for (;packetRecv.bytesUsed<packetRecv.bytesAvailable;packetRecv.bytesUsed=flap_length)
@@ -601,31 +601,31 @@ void __cdecl CAimProto::aim_admin_negotiation( void* )
if (!flap.len())
break;
flap_length+=FLAP_SIZE+flap.len();
- if(flap.cmp(0x01))
+ if (flap.cmp(0x01))
{
aim_send_cookie(hAdminConn,admin_seqno,ADMIN_COOKIE_LENGTH,ADMIN_COOKIE);//cookie challenge
mir_free(ADMIN_COOKIE);
ADMIN_COOKIE=NULL;
ADMIN_COOKIE_LENGTH=0;
}
- else if(flap.cmp(0x02))
+ else if (flap.cmp(0x02))
{
SNAC snac(flap.val(),flap.snaclen());
- if(snac.cmp(0x0001))
+ if (snac.cmp(0x0001))
{
snac_supported_families(snac,hAdminConn,admin_seqno);
snac_supported_family_versions(snac,hAdminConn,admin_seqno);
snac_admin_rate_limitations(snac,hAdminConn,admin_seqno);
snac_error(snac);
}
- if(snac.cmp(0x0007))
+ if (snac.cmp(0x0007))
{
snac_admin_account_infomod(snac);
snac_admin_account_confirm(snac);
snac_error(snac);
}
}
- else if(flap.cmp(0x04))
+ else if (flap.cmp(0x04))
goto exit;
}
}
diff --git a/protocols/AimOscar/src/conv.cpp b/protocols/AimOscar/src/conv.cpp
index ebe531876f..95ee6aac0a 100644
--- a/protocols/AimOscar/src/conv.cpp
+++ b/protocols/AimOscar/src/conv.cpp
@@ -287,7 +287,7 @@ char* html_to_bbcodes(char *src)
memmove(ptr+2, ptr, strlen(ptr) + 1);
memcpy(ptr,"[/url]",6);
}
- else if(s2&&s2<s1||s2&&!s1)
+ else if (s2&&s2<s1||s2&&!s1)
{
ptr=s2;
ptr=strip_tag_within(begin,ptr);
@@ -333,7 +333,7 @@ char* html_to_bbcodes(char *src)
memmove(ptr+2, ptr, strlen(ptr) + 1);
memcpy(ptr,"[/url]",6);
}
- else if(s2&&s2<s1||s2&&!s1)
+ else if (s2&&s2<s1||s2&&!s1)
{
ptr=s2;
ptr=strip_tag_within(begin,ptr);
@@ -380,7 +380,7 @@ char* html_to_bbcodes(char *src)
memmove(ptr+1, ptr, strlen(ptr) + 1);
memcpy(ptr,"[/color]",8);
}
- else if(s2&&s2<s1||s2&&!s1)
+ else if (s2&&s2<s1||s2&&!s1)
{
ptr=s2;
memmove(ptr+8, ptr, strlen(ptr) + 1);
@@ -418,7 +418,7 @@ char* html_to_bbcodes(char *src)
memmove(ptr+1, ptr, strlen(ptr) + 1);
memcpy(ptr,"[/color]",8);
}
- else if(s2&&s2<s1||s2&&!s1)
+ else if (s2&&s2<s1||s2&&!s1)
{
ptr=s2;
memmove(ptr+8, ptr, strlen(ptr) + 1);
@@ -584,7 +584,7 @@ char* strip_tag_within(char* begin, char* end)
{
while(char* sub_begin=strchr(begin,'<'))
{
- if(sub_begin<end)//less than the original ending
+ if (sub_begin<end)//less than the original ending
{
char* sub_end=strchr(begin,'>');
strip_tag(sub_begin,sub_end);
@@ -630,69 +630,69 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem)
COLORREF isColor=cfOld.crTextColor;
COLORREF isBackColor=cfOld.crBackColor;
int isSize;
- if(cfOld.yHeight==38*20)
+ if (cfOld.yHeight==38*20)
isSize=7;
- else if(cfOld.yHeight==24*20)
+ else if (cfOld.yHeight==24*20)
isSize=6;
- else if(cfOld.yHeight==18*20)
+ else if (cfOld.yHeight==18*20)
isSize=5;
- else if(cfOld.yHeight==14*20)
+ else if (cfOld.yHeight==14*20)
isSize=4;
- else if(cfOld.yHeight==12*20)
+ else if (cfOld.yHeight==12*20)
isSize=3;
- else if(cfOld.yHeight==10*20)
+ else if (cfOld.yHeight==10*20)
isSize=2;
- else if(cfOld.yHeight==8*20)
+ else if (cfOld.yHeight==8*20)
isSize=1;
else
isSize=3;
TCHAR text[3] =_T("");
SendDlgItemMessage(hwndDlg, DlgItem, EM_GETSELTEXT, 0, (LPARAM)&text);
- if(Bold!=isBold)
+ if (Bold!=isBold)
{
Bold=isBold;
- if(isBold)
+ if (isBold)
{
strcpy(&buf[pos],"<b>");
pos+=3;
}
else
{
- if(start!=0)
+ if (start!=0)
{
strcpy(&buf[pos],"</b>");
pos+=4;
}
}
}
- if(Italic!=isItalic)
+ if (Italic!=isItalic)
{
Italic=isItalic;
- if(isItalic)
+ if (isItalic)
{
strcpy(&buf[pos],"<i>");
pos+=3;
}
else
{
- if(start!=0)
+ if (start!=0)
{
strcpy(&buf[pos],"</i>");
pos+=4;
}
}
}
- if(Underline!=isUnderline)
+ if (Underline!=isUnderline)
{
Underline=isUnderline;
- if(isUnderline)
+ if (isUnderline)
{
strcpy(&buf[pos],"<u>");
pos+=3;
}
else
{
- if(start!=0)
+ if (start!=0)
{
strcpy(&buf[pos],"</u>");
pos+=4;
@@ -705,7 +705,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem)
Color=isColor;
BackColor=isBackColor;
strcpy(Face,cfOld.szFaceName);
- if(start!=0)
+ if (start!=0)
{
strcpy(&buf[pos],"</font>");
pos+=7;
@@ -725,7 +725,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem)
char chBackColor[7];
_itoa((_htonl(BackColor)>>8),chBackColor,16);
size_t len=strlen(chBackColor);
- if(len<6)
+ if (len<6)
{
memmove(chBackColor+(6-len),chBackColor,len+1);
for(int i=0;i<6;i++)
@@ -741,7 +741,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem)
char chColor[7];
_itoa((_htonl(Color)>>8),chColor,16);
size_t len=strlen(chColor);
- if(len<6)
+ if (len<6)
{
memmove(chColor+(6-len),chColor,len+1);
for(int i=0;i<6;i++)
@@ -760,7 +760,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem)
strcpy(&buf[pos],">");
pos++;
}
- if(text[0]=='\r')
+ if (text[0]=='\r')
{
strcpy(&buf[pos],"<br>");
pos+=4;
@@ -775,17 +775,17 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem)
start++;
end++;
}
- if(Bold)
+ if (Bold)
{
strcpy(&buf[pos],"</b>");
pos+=4;
}
- if(Italic)
+ if (Italic)
{
strcpy(&buf[pos],"</i>");
pos+=4;
}
- if(Underline)
+ if (Underline)
{
strcpy(&buf[pos],"</u>");
pos+=4;
diff --git a/protocols/AimOscar/src/flap.cpp b/protocols/AimOscar/src/flap.cpp
index f652aff710..8b9e08b372 100644
--- a/protocols/AimOscar/src/flap.cpp
+++ b/protocols/AimOscar/src/flap.cpp
@@ -21,14 +21,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
FLAP::FLAP(char* buf,int num_bytes)
{
- if(FLAP_SIZE>num_bytes)
+ if (FLAP_SIZE>num_bytes)
{
length_=0;
}
else
{
length_=_htons((*(unsigned short*)&buf[4]));
- if(FLAP_SIZE+length_>num_bytes)
+ if (FLAP_SIZE+length_>num_bytes)
{
length_=0;
}
@@ -49,7 +49,7 @@ unsigned short FLAP::snaclen()
}
int FLAP::cmp(unsigned short type)
{
- if(type_==type)
+ if (type_==type)
return 1;
else
return 0;
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp
index 17c8fc3a88..4b770d1fdf 100644
--- a/protocols/AimOscar/src/proto.cpp
+++ b/protocols/AimOscar/src/proto.cpp
@@ -81,13 +81,13 @@ CAimProto::~CAimProto()
RemoveMainMenus();
RemoveContactMenus();
- if(hServerConn)
+ if (hServerConn)
Netlib_CloseHandle(hServerConn);
- if(hAvatarConn && hAvatarConn != (HANDLE)1)
+ if (hAvatarConn && hAvatarConn != (HANDLE)1)
Netlib_CloseHandle(hAvatarConn);
- if(hChatNavConn && hChatNavConn != (HANDLE)1)
+ if (hChatNavConn && hChatNavConn != (HANDLE)1)
Netlib_CloseHandle(hChatNavConn);
- if(hAdminConn && hAdminConn != (HANDLE)1)
+ if (hAdminConn && hAdminConn != (HANDLE)1)
Netlib_CloseHandle(hAdminConn);
close_chat_conn();
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index a968c20bd5..9df0f81c7f 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -268,19 +268,19 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
else
deleteSetting(hContact, "Transport" );
- if(admin_aol)
+ if (admin_aol)
{
setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_ADMIN);
}
- else if(aol)
+ else if (aol)
{
setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_AOL);
}
- else if(icq)
+ else if (icq)
{
setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_ICQ);
}
- else if(unconfirmed)
+ else if (unconfirmed)
{
setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_UNCONFIRMED);
}
@@ -289,17 +289,17 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
setByte(hContact, AIM_KEY_AC, ACCOUNT_TYPE_CONFIRMED);
}
- if(bot)
+ if (bot)
{
strcpy(client,CLIENT_BOT);
bot_user=1;
}
- if(wireless)
+ if (wireless)
{
strcpy(client,CLIENT_SMS);
wireless_user=1;
}
- else if(away)
+ else if (away)
{
away_user=1;
}
@@ -407,93 +407,93 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
for(int i=0;i<tlv.len();i=i+2)
{
unsigned short cap=tlv.ushort(i);
- //if(cap==0x134E)
+ //if (cap==0x134E)
// utf8=1;
- if(cap==0xf002)
+ if (cap==0xf002)
f002=1;
- if(cap==0xf003)
+ if (cap==0xf003)
f003=1;
- if(cap==0xf004)
+ if (cap==0xf004)
f004=1;
- if(cap==0xf005)
+ if (cap==0xf005)
f005=1;
- if(cap==0xf007)
+ if (cap==0xf007)
f007=1;
- if(cap==0xf008)
+ if (cap==0xf008)
f008=1;
- if(cap==0x0101)
+ if (cap==0x0101)
O101=1;
- if(cap==0x0102)
+ if (cap==0x0102)
O102=1;
- if(cap==0x0103)
+ if (cap==0x0103)
O103=1;
- if(cap==0x0104)
+ if (cap==0x0104)
O104=1;
- if(cap==0x0105)
+ if (cap==0x0105)
O105=1;
- if(cap==0x0107)
+ if (cap==0x0107)
O107=1;
- if(cap==0x010a)
+ if (cap==0x010a)
O10a=1;
- if(cap==0x010c)
+ if (cap==0x010c)
O10c=1;
- if(cap==0x010d)
+ if (cap==0x010d)
O10d=1;
- if(cap==0x01ff)
+ if (cap==0x01ff)
O1ff=1;
- if(cap==0x1323)
+ if (cap==0x1323)
{
strcpy(client,CLIENT_GPRS);
hiptop_user=1;
}
- if(cap==0x1341)
+ if (cap==0x1341)
l341=1;
- if(cap==0x1343)
+ if (cap==0x1343)
l343=1;
- if(cap==0x1345)
+ if (cap==0x1345)
l345=1;
- if(cap==0x1346)
+ if (cap==0x1346)
l346=1;
- if(cap==0x1347)
+ if (cap==0x1347)
l347=1;
- if(cap==0x1348)
+ if (cap==0x1348)
l348=1;
- if(cap==0x1349)
+ if (cap==0x1349)
l349=1;
- if(cap==0x134b)
+ if (cap==0x134b)
l34b=1;
- if(cap==0x134e)
+ if (cap==0x134e)
l34e=1;
}
- if(f002&&f003&&f004&&f005)
+ if (f002&&f003&&f004&&f005)
strcpy(client,CLIENT_TRILLIAN_PRO);
else if ((f004&&f005&&f007&&f008) || (f004&&f005&&O104&&O105))
strcpy(client,CLIENT_ICHAT);
- else if(f003&f004&f005)
+ else if (f003&f004&f005)
strcpy(client,CLIENT_TRILLIAN);
- else if(l343&&O1ff&&tlv.len()==4)
+ else if (l343&&O1ff&&tlv.len()==4)
strcpy(client,CLIENT_TRILLIAN_ASTRA);
- else if(l343&&tlv.len()==2)
+ else if (l343&&tlv.len()==2)
strcpy(client,CLIENT_AIMTOC);
- else if(l343&&l345&&l346&&tlv.len()==6)
+ else if (l343&&l345&&l346&&tlv.len()==6)
strcpy(client,CLIENT_GAIM);
- else if(l343&&l345&&l346&&l34e&&tlv.len()==8)
+ else if (l343&&l345&&l346&&l34e&&tlv.len()==8)
strcpy(client,CLIENT_PURPLE);
- else if(l343&&l345&&l346&&l349&&l34e&&tlv.len()==10)
+ else if (l343&&l345&&l346&&l349&&l34e&&tlv.len()==10)
strcpy(client,CLIENT_PURPLE);
- else if(l343&&l345&&l34e&&tlv.len()==6)
+ else if (l343&&l345&&l34e&&tlv.len()==6)
strcpy(client,CLIENT_ADIUM);
- else if(l343&&l346&&l34e&&tlv.len()==6)
+ else if (l343&&l346&&l34e&&tlv.len()==6)
strcpy(client,CLIENT_TERRAIM);
- else if(tlv.len()==0 && getWord(hContact, AIM_KEY_ST,0)!=ID_STATUS_ONTHEPHONE)
+ else if (tlv.len()==0 && getWord(hContact, AIM_KEY_ST,0)!=ID_STATUS_ONTHEPHONE)
strcpy(client,CLIENT_AIMEXPRESS5);
- else if(l34b&&l343&&O1ff&&l345&&l346&&tlv.len()==10)
+ else if (l34b&&l343&&O1ff&&l345&&l346&&tlv.len()==10)
strcpy(client,CLIENT_AIMEXPRESS6);
- else if(l34b&&l341&&l343&&O1ff&&l345&&l346&&l347)
+ else if (l34b&&l341&&l343&&O1ff&&l345&&l346&&l347)
strcpy(client,CLIENT_AIM5);
- else if(l34b&&l341&&l343&&l345&l346&&l347&&l348)
+ else if (l34b&&l341&&l343&&l345&l346&&l347&&l348)
strcpy(client,CLIENT_AIM4);
- else if(O1ff&&l343&&O107&&l341&&O104&&O105&&O101&&l346)
+ else if (O1ff&&l343&&O107&&l341&&O104&&O105&&O101&&l346)
{
if (O10d)
strcpy(client,CLIENT_AIM6_9);
@@ -504,13 +504,13 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
else
strcpy(client,CLIENT_AIM_TRITON);
}
- else if(O1ff&&l343&&l341&&O104&&O105&&O101&&l346)
+ else if (O1ff&&l343&&l341&&O104&&O105&&O101&&l346)
strcpy(client,CLIENT_AIM7_0);
- else if(l346&&l34e&&tlv.len()==4)
+ else if (l346&&l34e&&tlv.len()==4)
strcpy(client,CLIENT_MEEBO);
- else if(l34e&&tlv.len()==2)
+ else if (l34e&&tlv.len()==2)
strcpy(client,CLIENT_BEEJIVE);
- else if(l34e&&l343&&tlv.len()==4)
+ else if (l34e&&l343&&tlv.len()==4)
strcpy(client,CLIENT_BEEJIVE);
// setByte(hContact, AIM_KEY_US, utf8);
@@ -564,7 +564,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_SM);
}
}
- else if(tlv.cmp(0x0004))//idle tlv
+ else if (tlv.cmp(0x0004))//idle tlv
{
if (hContact)
{
@@ -625,7 +625,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
}
void CAimProto::snac_user_offline(SNAC &snac)//family 0x0003
{
- if(snac.subcmp(0x000c))
+ if (snac.subcmp(0x000c))
{
unsigned char buddy_length=snac.ubyte();
char* buddy=snac.part(1,buddy_length);
@@ -637,7 +637,7 @@ void CAimProto::snac_user_offline(SNAC &snac)//family 0x0003
}
void CAimProto::snac_error(SNAC &snac)//family 0x0003 or 0x0004
{
- if(snac.subcmp(0x0001))
+ if (snac.subcmp(0x0001))
{
get_error(snac.ushort());
}
@@ -758,9 +758,9 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset)
{
TLV tlv(snac.val(tlv_base + tlv_offset));
- if(tlv.cmp(0x00ca))
+ if (tlv.cmp(0x00ca))
pd_mode = tlv.ubyte();
- else if(tlv.cmp(0x00cc))
+ else if (tlv.cmp(0x00cc))
pd_flags = tlv.ulong();
tlv_offset += TLV_HEADER_SIZE + tlv.len();
@@ -906,9 +906,9 @@ void CAimProto::modify_ssi_list(SNAC &snac, int &offset)
{
TLV tlv(snac.val(tlv_base + tlv_offset));
- if(tlv.cmp(0x00ca))
+ if (tlv.cmp(0x00ca))
pd_mode = tlv.ubyte();
- else if(tlv.cmp(0x00cc))
+ else if (tlv.cmp(0x00cc))
pd_flags = tlv.ulong();
tlv_offset += TLV_HEADER_SIZE + tlv.len();
@@ -1129,13 +1129,10 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
unsigned char sn_length = snac.ubyte(10);
char* sn = snac.part(11,sn_length);
- HANDLE hContact = contact_from_sn(sn, true, true);
+ HANDLE hContact = contact_from_sn(sn, true, true), hMsgContact = NULL;
int offset=15+sn_length;
- CCSDATA ccs={0};
- PROTORECVEVENT pre;
-
char* msg_buf=NULL;
unsigned long offline_timestamp = 0;
bool is_offline = false;
@@ -1164,26 +1161,24 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
// some extra sanity
if (offset>=snac.len()) break;
}
- while (offset<snac.len())
+
+ while (offset < snac.len())
{
TLV tlv(snac.val(offset));
- offset+=TLV_HEADER_SIZE;
+ offset += TLV_HEADER_SIZE;
if (tlv.cmp(0x0004)&&!tlv.len())//auto response flag
- {
- auto_response=1;
- }
- if (tlv.cmp(0x0002))//msg
+ auto_response = 1;
+
+ if (tlv.cmp(0x0002)) //msg
{
unsigned short caps_length=tlv.ushort(2);
unsigned short msg_length=tlv.ushort(6+caps_length)-4;
unsigned short encoding=tlv.ushort(8+caps_length);
- char* buf=tlv.part(12+caps_length,msg_length);
- if(hContact)
- {
+ char* buf = tlv.part(12+caps_length,msg_length);
+ if (hContact) {
wchar_t* wbuf;
- ccs.hContact = hContact;
- switch (encoding)
- {
+ hMsgContact = hContact;
+ switch (encoding) {
case 2:
wbuf = (wchar_t*)buf;
wcs_htons(wbuf);
@@ -1206,84 +1201,59 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
}
}
}
+
if (tlv.cmp(0x0004) && !tlv.len())//auto response flag
- {
- auto_response=1;
- }
- if (channel == 2 && tlv.cmp(0x0005))//recv rendervous packet
- {
+ auto_response = 1;
+
+ if (channel == 2 && tlv.cmp(0x0005)) { //recv rendervous packet
rdz_msg_type = snac.ushort(offset);
icbm_cookie = snac.part(offset+2,8);
- if (cap_cmp(snac.val(offset+10), AIM_CAP_FILE_TRANSFER) == 0)
- {
- for (int i = 26; i < tlv.len(); )
- {
+ if (cap_cmp(snac.val(offset+10), AIM_CAP_FILE_TRANSFER) == 0) {
+ for (int i = 26; i < tlv.len(); ) {
TLV tlv(snac.val(offset+i));
if (tlv.cmp(0x000A))
- {
request_num=tlv.ushort();//for file transfer
- }
- else if(tlv.cmp(0x0002))//proxy ip
- {
+ else if (tlv.cmp(0x0002))//proxy ip
proxy_ip = tlv.ulong();
- }
- else if(tlv.cmp(0x0003))//client ip
- {
+ else if (tlv.cmp(0x0003))//client ip
local_ip = tlv.ulong();
- }
- else if(tlv.cmp(0x0004))//verified ip
- {
+ else if (tlv.cmp(0x0004))//verified ip
verified_ip = tlv.ulong();
- }
- else if(tlv.cmp(0x0005))
- {
+ else if (tlv.cmp(0x0005))
port=tlv.ushort();
- }
- else if(tlv.cmp(0x0010))
- {
+ else if (tlv.cmp(0x0010))
force_proxy=1;
- }
else if (tlv.cmp(0x0012))
- {
max_ver = tlv.ushort();
- }
- else if (tlv.cmp(0x2711))
- {
+ else if (tlv.cmp(0x2711)) {
num_files = tlv.ushort(2);
file_size = tlv.ulong(4);
filename = tlv.part(8, tlv.len()-8);
}
- else if (tlv.cmp(0x2712))
- {
+ else if (tlv.cmp(0x2712)) {
char* enc = tlv.dup();
utf_fname = strcmp(enc, "utf-8") == 0;
mir_free(enc);
}
- else if (tlv.cmp(0x2713))
- {
+ else if (tlv.cmp(0x2713)) {
file_size = tlv.u64();
}
- else if (tlv.cmp(0x000c))
- {
+ else if (tlv.cmp(0x000c)) {
msg_buf = unicode_descr ? tlv.dupw() : tlv.dup();
html_decode(msg_buf);
descr_included = true;
- if (strstr(msg_buf, "<ICQ_COOL_FT>"))
- {
+ if (strstr(msg_buf, "<ICQ_COOL_FT>")) {
char* beg = strstr(msg_buf, "<DESC>");
char* end = strstr(msg_buf, "</DESC>");
- if (beg && end && beg < end)
- {
+ if (beg && end && beg < end) {
beg += 6;
end[0] = 0;
memmove(msg_buf, beg, end - beg + 1);
}
- else
- descr_included = false;
+ else descr_included = false;
}
}
- else if(tlv.cmp(0x000d))
- {
+ else if (tlv.cmp(0x000d)) {
char* enc = tlv.dup();
unicode_descr = strcmp(enc, "unicode-2-0") == 0;
mir_free(enc);
@@ -1291,47 +1261,29 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
i += TLV_HEADER_SIZE + tlv.len();
}
}
- else if (cap_cmp(snac.val(offset+10), AIM_CAP_RTCAUDIO) == 0 ||
- cap_cmp(snac.val(offset+10), AIM_CAP_RTCVIDEO) == 0)
- {
- for (int i = 26; i < tlv.len(); )
- {
+ else if (cap_cmp(snac.val(offset+10), AIM_CAP_RTCAUDIO) == 0 || cap_cmp(snac.val(offset+10), AIM_CAP_RTCVIDEO) == 0) {
+ for (int i = 26; i < tlv.len(); ) {
TLV tlv(snac.val(offset+i));
if (tlv.cmp(0x000A))
- {
request_num=tlv.ushort();//for file transfer
- }
- else if(tlv.cmp(0x0002))//proxy ip
- {
+ else if (tlv.cmp(0x0002))//proxy ip
proxy_ip = tlv.ulong();
- }
- else if(tlv.cmp(0x0003))//client ip
- {
+ else if (tlv.cmp(0x0003))//client ip
local_ip = tlv.ulong();
- }
- else if(tlv.cmp(0x0004))//verified ip
- {
+ else if (tlv.cmp(0x0004))//verified ip
verified_ip = tlv.ulong();
- }
- else if(tlv.cmp(0x0005))
- {
+ else if (tlv.cmp(0x0005))
port=tlv.ushort();
- }
}
channel = 0;
break;
}
- else if (cap_cmp(snac.val(offset+10), AIM_CAP_CHAT) == 0)//it's a chat invite request
- {
- for(int i=26;i<tlv.len();)
- {
+ else if (cap_cmp(snac.val(offset+10), AIM_CAP_CHAT) == 0) { //it's a chat invite request
+ for(int i=26; i < tlv.len();) {
TLV tlv(snac.val(offset+i));
- if(tlv.cmp(0x000c))//optional message
- {
+ if (tlv.cmp(0x000c)) //optional message
msg_buf = tlv.dup();
- }
- else if(tlv.cmp(0x2711))//room information
- {
+ else if (tlv.cmp(0x2711)) { //room information
int cookie_len=tlv.ubyte(2);
chatnav_param* par =
new chatnav_param(tlv.part(3,cookie_len), tlv.ushort(), tlv.ushort(3+cookie_len),
@@ -1343,30 +1295,26 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
i+=TLV_HEADER_SIZE+tlv.len();
}
}
- else
- {
+ else {
channel = 0;
break;
}
}
+
if (channel == 6 && tlv.cmp(0x0005))//audio/video tunnel
- {
msg_buf = tlv.dup();
- }
+
if (tlv.cmp(0x0006))//Offline message flag
- {
is_offline = true;
- }
+
if (tlv.cmp(0x0016))//Offline message timestamp
- {
offline_timestamp = tlv.ulong(0);
- }
- offset+=(tlv.len());
+
+ offset += (tlv.len());
}
- if (channel == 1)//Message not file
- {
- if (auto_response)//this message must be an autoresponse
- {
+
+ if (channel == 1) { //Message not file
+ if (auto_response) { //this message must be an autoresponse
char* away = mir_utf8encodeT(TranslateT("[Auto-Response]:"));
size_t len = strlen(msg_buf) + strlen(away) + 2;
char* buf = (char*)mir_alloc(len);
@@ -1377,20 +1325,17 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
}
// Okay we are setting up the structure to give the message back to miranda's core
- pre.flags = PREF_UTF;
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hMsgContact, 0);
+ {
+ PROTORECVEVENT pre;
+ pre.flags = PREF_UTF;
+ pre.timestamp = (is_offline) ? offline_timestamp : (DWORD)time(0);
+ pre.szMessage = msg_buf;
+ pre.lParam = 0;
+ ProtoChainRecvMsg(hMsgContact, &pre);
+ }
- if (is_offline)
- pre.timestamp = offline_timestamp;
- else
- pre.timestamp = (DWORD)time(NULL);
- pre.szMessage = msg_buf;
- pre.lParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)ccs.hContact, 0);
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
- if(m_iStatus==ID_STATUS_AWAY && !auto_response && !getByte(AIM_KEY_DM,0))
+ if (m_iStatus==ID_STATUS_AWAY && !auto_response && !getByte(AIM_KEY_DM,0))
{
unsigned long msg_time = getDword(hContact, AIM_KEY_LM, 0);
unsigned long away_time = getDword(AIM_KEY_LA, 0);
@@ -1457,12 +1402,7 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
pre.tszDescription = mir_utf8decodeT(msg_buf);
pre.ptszFiles = &filenameT;
pre.lParam = (LPARAM)ft;
-
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(hContact, &pre);
mir_free(pre.tszDescription);
mir_free(filenameT);
@@ -1587,7 +1527,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004
}
void CAimProto::snac_received_info(SNAC &snac)//family 0x0002
{
- if(snac.subcmp(0x0006))
+ if (snac.subcmp(0x0006))
{
unsigned short offset = 0;
int i = 0;
@@ -1659,19 +1599,19 @@ void CAimProto::snac_received_info(SNAC &snac)//family 0x0002
}
void CAimProto::snac_typing_notification(SNAC &snac)//family 0x004
{
- if(snac.subcmp(0x0014))
+ if (snac.subcmp(0x0014))
{
unsigned char sn_length=snac.ubyte(10);
char* sn=snac.part(11,sn_length);
HANDLE hContact=contact_from_sn(sn);
- if(hContact)
+ if (hContact)
{
unsigned short type=snac.ushort(11+sn_length);
- if(type==0x0000)//typing finished
+ if (type==0x0000)//typing finished
CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)hContact,(WPARAM)PROTOTYPE_CONTACTTYPING_OFF);
- else if(type==0x0001)//typed
+ else if (type==0x0001)//typed
CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)hContact,PROTOTYPE_CONTACTTYPING_INFINITE);
- else if(type==0x0002)//typing
+ else if (type==0x0002)//typing
CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)hContact,(LPARAM)60);
}
mir_free(sn);
@@ -1779,24 +1719,24 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
while (offset < snac.len())
{
TLV tlv(snac.val(offset));
- if(tlv.cmp(0x000d))
+ if (tlv.cmp(0x000d))
{
family=tlv.ushort();
}
- else if(tlv.cmp(0x0005))
+ else if (tlv.cmp(0x0005))
{
server=tlv.dup();
}
- else if(tlv.cmp(0x0006))
+ else if (tlv.cmp(0x0006))
{
local_cookie=tlv.dup();
local_cookie_length=tlv.len();
}
- else if(tlv.cmp(0x008d))
+ else if (tlv.cmp(0x008d))
{
host=tlv.dup();
}
- else if(tlv.cmp(0x008e))
+ else if (tlv.cmp(0x008e))
{
use_ssl=tlv.ubyte();
}
@@ -1805,7 +1745,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
if (family == 0x0018)
{
hMailConn = aim_connect(server, get_default_port(), false/*use_ssl != 0*/, host);
- if(hMailConn)
+ if (hMailConn)
{
LOG("Successfully Connected to the Mail Server.");
MAIL_COOKIE=local_cookie;
@@ -1818,7 +1758,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
else if (family == 0x0010)
{
hAvatarConn = aim_connect(server, get_default_port(), false/*use_ssl != 0*/);
- if(hAvatarConn)
+ if (hAvatarConn)
{
LOG("Successfully Connected to the Avatar Server.");
AVATAR_COOKIE = local_cookie;
@@ -1831,7 +1771,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
else if (family == 0x000D)
{
hChatNavConn = aim_connect(server, get_default_port(), use_ssl != 0, host);
- if(hChatNavConn)
+ if (hChatNavConn)
{
LOG("Successfully Connected to the Chat Navigation Server.");
CHATNAV_COOKIE = local_cookie;
@@ -1863,7 +1803,7 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001
else if (family == 0x0007)
{
hAdminConn = aim_connect(server, get_default_port(), false /*use_ssl != 0*/);
- if(hAdminConn)
+ if (hAdminConn)
{
LOG("Successfully Connected to the Admin Server.");
ADMIN_COOKIE = local_cookie;
@@ -2018,7 +1958,7 @@ void CAimProto::snac_email_search_results(SNAC &snac)//family 0x000A
void CAimProto::snac_chatnav_info_response(SNAC &snac,HANDLE hServerConn,unsigned short &seqno)//family 0x000D
{
- if(snac.subcmp(0x0009))
+ if (snac.subcmp(0x0009))
{
LOG("Chat Info Received");
@@ -2317,7 +2257,7 @@ void CAimProto::snac_admin_account_infomod(SNAC &snac)//family 0x0007
// Display messages
if (email)
setString(AIM_KEY_EM,email); // Save our email for future reference.
- if(sn)
+ if (sn)
setString(AIM_KEY_SN,sn); // Update the database to reflect the formatted name.
sendBroadcast( NULL, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0 );
@@ -2374,7 +2314,7 @@ void CAimProto::snac_admin_account_confirm(SNAC &snac)//family 0x0007
/*void CAimProto::snac_delete_contact(SNAC &snac, char* buf)//family 0x0013
{
- if(snac.subcmp(0x000a))
+ if (snac.subcmp(0x000a))
{
char sn[33];
int sn_length=buf[SNAC_SIZE*2];
@@ -2382,7 +2322,7 @@ void CAimProto::snac_admin_account_confirm(SNAC &snac)//family 0x0007
ZeroMemory(sn,sizeof(sn));
memcpy(sn,&buf[SNAC_SIZE*2+1],sn_length);
hContact=find_contact(sn);
- if(hContact)
+ if (hContact)
{
unsigned short* type=(unsigned short*)&buf[SNAC_SIZE*2+1+sn_length];
*type=htons(*type);
diff --git a/protocols/AimOscar/src/snac.cpp b/protocols/AimOscar/src/snac.cpp
index ed8af265fe..a9607b600b 100644
--- a/protocols/AimOscar/src/snac.cpp
+++ b/protocols/AimOscar/src/snac.cpp
@@ -32,14 +32,14 @@ SNAC::SNAC(char* buf,unsigned short length)
}
int SNAC::cmp(unsigned short service)
{
- if(service_==service)
+ if (service_==service)
return 1;
else
return 0;
}
int SNAC::subcmp(unsigned short subgroup)
{
- if(subgroup_==subgroup)
+ if (subgroup_==subgroup)
return 1;
else
return 0;
diff --git a/protocols/AimOscar/src/tlv.cpp b/protocols/AimOscar/src/tlv.cpp
index f458a28eb0..657e6af1a6 100644
--- a/protocols/AimOscar/src/tlv.cpp
+++ b/protocols/AimOscar/src/tlv.cpp
@@ -36,7 +36,7 @@ TLV::TLV(unsigned short type, unsigned short length, const char* value)
{
type_ = type;
length_ = length;
- if(length_ > 0)
+ if (length_ > 0)
{
value_ = (char*)mir_alloc(length_+1);
memcpy(value_, value, length_);
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index 76b50b9741..6e3f439f35 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -41,9 +41,9 @@ void DrawMyControl(HDC hDC, HWND /*hwndButton*/, HANDLE hTheme, UINT iState, REC
if (hTheme)
{
DWORD state = (bIsPressed)?PBS_PRESSED:PBS_NORMAL;
- if(state == PBS_NORMAL)
+ if (state == PBS_NORMAL)
{
- if(bIsFocused)
+ if (bIsFocused)
state = PBS_DEFAULTED;
}
rect.top-=1;
@@ -137,22 +137,22 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
#define MIN_WIDTH 400
if (WMSZ_RIGHT==wParam||WMSZ_TOPRIGHT==wParam||WMSZ_BOTTOMRIGHT==wParam)
{
- if(rect->right-rect->left<MIN_WIDTH)
+ if (rect->right-rect->left<MIN_WIDTH)
rect->right=rect->left+MIN_WIDTH;
}
if (WMSZ_LEFT==wParam||WMSZ_TOPLEFT==wParam||WMSZ_BOTTOMLEFT==wParam)
{
- if(rect->right-rect->left<MIN_WIDTH)
+ if (rect->right-rect->left<MIN_WIDTH)
rect->left=rect->right-MIN_WIDTH;
}
if (WMSZ_TOP==wParam||WMSZ_TOPRIGHT==wParam||WMSZ_TOPLEFT==wParam)
{
- if(rect->bottom-rect->top<MIN_HEIGHT)
+ if (rect->bottom-rect->top<MIN_HEIGHT)
rect->top=rect->bottom-MIN_HEIGHT;
}
if (WMSZ_BOTTOM==wParam||WMSZ_BOTTOMLEFT==wParam||WMSZ_BOTTOMRIGHT==wParam)
{
- if(rect->bottom-rect->top<MIN_HEIGHT)
+ if (rect->bottom-rect->top<MIN_HEIGHT)
rect->bottom=rect->top+MIN_HEIGHT;
}
break;
@@ -233,7 +233,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
cfOld.dwMask = CFM_SUPERSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld);
BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT);
- if(isSuper)
+ if (isSuper)
{
DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem);
DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sup_scrpt"), 16, 16, 0, 0, DI_NORMAL);
@@ -274,7 +274,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
cfOld.dwMask = CFM_SUBSCRIPT;
SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld);
BOOL isSub = (cfOld.dwEffects & CFE_SUBSCRIPT) && (cfOld.dwMask & CFM_SUBSCRIPT);
- if(isSub)
+ if (isSub)
{
DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem);
DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("sub_scrpt"), 16, 16, 0, 0, DI_NORMAL);
@@ -307,7 +307,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
ReleaseIconEx("bold");
}
}
- else if(lpDIS->CtlID == IDC_ITALIC)
+ else if (lpDIS->CtlID == IDC_ITALIC)
{
CHARFORMAT2 cfOld;
cfOld.cbSize = sizeof(CHARFORMAT2);
@@ -521,7 +521,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
break;
case IDC_UNDERLINE:
- if(HIWORD(wParam)==BN_CLICKED)
+ if (HIWORD(wParam)==BN_CLICKED)
{
CHARFORMAT2 cfOld;
cfOld.cbSize = sizeof(CHARFORMAT2);
@@ -563,7 +563,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
cc.hInstance=(HWND)GetModuleHandle(NULL);
cc.lpCustColors=custColours;
cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
- if(ChooseColor(&cc))
+ if (ChooseColor(&cc))
{
foreground=cc.rgbResult;
InvalidateRect(GetDlgItem(hwndDlg, IDC_FOREGROUNDCOLOR), NULL, FALSE);
@@ -586,7 +586,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
break;
case IDC_BACKGROUNDCOLORPICKER:
- if(HIWORD(wParam)==BN_CLICKED)
+ if (HIWORD(wParam)==BN_CLICKED)
{
CHOOSECOLOR cc={0};
custColours[0]=foreground;
@@ -596,7 +596,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
cc.hInstance=(HWND)GetModuleHandle(NULL);
cc.lpCustColors=custColours;
cc.Flags=CC_ANYCOLOR|CC_FULLOPEN|CC_RGBINIT;
- if(ChooseColor(&cc))
+ if (ChooseColor(&cc))
{
background=cc.rgbResult;
InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUNDCOLOR), NULL, FALSE);
@@ -878,14 +878,14 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
char str[128];
//SN
GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str));
- if(strlen(str)>0)
+ if (strlen(str)>0)
ppro->setString(AIM_KEY_SN, str);
else
ppro->deleteSetting(NULL, AIM_KEY_SN);
//END SN
//NK
- if(GetDlgItemTextA(hwndDlg, IDC_NK, str, sizeof(str)))
+ if (GetDlgItemTextA(hwndDlg, IDC_NK, str, sizeof(str)))
ppro->setString(AIM_KEY_NK, str);
else
{
@@ -896,7 +896,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//PW
GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(str));
- if(strlen(str)>0)
+ if (strlen(str)>0)
{
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), (LPARAM) str);
ppro->setString(AIM_KEY_PW, str);
@@ -907,7 +907,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//HN
GetDlgItemTextA(hwndDlg, IDC_HN, str, sizeof(str));
- if(strlen(str)>0 && strcmp(str, AIM_DEFAULT_SERVER))
+ if (strlen(str)>0 && strcmp(str, AIM_DEFAULT_SERVER))
ppro->setString(AIM_KEY_HN, str);
else
ppro->deleteSetting(NULL, AIM_KEY_HN);
@@ -935,7 +935,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->deleteSetting(NULL, AIM_KEY_PN);
@@ -952,7 +952,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else
{
int acc_disabled = ppro->getByte(AIM_KEY_AT, 0);
- if(acc_disabled)
+ if (acc_disabled)
add_AT_icons(ppro);
ppro->setByte(AIM_KEY_AT, 0);
}
@@ -969,7 +969,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
int es_disabled = ppro->getByte(AIM_KEY_ES, 0);
ppro->setByte(AIM_KEY_ES, 0);
- if(es_disabled)
+ if (es_disabled)
add_ES_icons(ppro);
}
//End
@@ -985,7 +985,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
else
{
int hf = ppro->getByte(AIM_KEY_HF, 0);
- if(hf)
+ if (hf)
ShowWindow(GetDlgItem(hwndDlg, IDC_MASQ), SW_SHOW);
ppro->setByte(AIM_KEY_HF, 0);
}
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 15359a9a9b..4617fb7875 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -90,7 +90,7 @@ void CAimProto::start_connection(void *arg)
{
int status = (int)arg;
- if(m_iStatus<=ID_STATUS_OFFLINE)
+ if (m_iStatus<=ID_STATUS_OFFLINE)
{
offline_contacts();
DBVARIANT dbv;
@@ -325,7 +325,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group)
void CAimProto::offline_contact(HANDLE hContact, bool remove_settings)
{
- if(remove_settings)
+ if (remove_settings)
{
//We need some of this stuff if we are still online.
for(int i=1;;++i)
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index 53370e2526..76769f472d 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -362,20 +362,13 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from)
RequestStatus(true, cont->m_addr.S_un.S_addr);
else
{
- CCSDATA ccs;
PROTORECVEVENT pre;
-
- ccs.hContact = FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status);
- ccs.szProtoService = pak.flIsUrl?PSR_URL:PSR_MESSAGE;
- ccs.wParam = 0;
- ccs.lParam =(LPARAM)&pre;
-
pre.flags = 0;
pre.timestamp = get_time();
pre.szMessage = pak.strMessage;
pre.lParam = 0;
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv( FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status),
+ pak.flIsUrl ? PSR_URL : PSR_MESSAGE, 0, (LPARAM)&pre );
TPacket npak;
ZeroMemory(&npak, sizeof(npak));
@@ -394,20 +387,12 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from)
if (pak.strAwayMessage && cont)
{
- CCSDATA ccs;
PROTORECVEVENT pre;
-
- ccs.hContact = FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status);
- ccs.szProtoService = PSR_AWAYMSG;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
-
pre.flags = 0;
pre.timestamp = get_time();
pre.szMessage = pak.strAwayMessage;
pre.lParam = pak.idAckAwayMessage;
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv( FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status), PSR_AWAYMSG, 0, (LPARAM)&pre);
}
if (pak.idReqAwayMessage && cont)
@@ -453,21 +438,6 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from)
}
LeaveCriticalSection(&m_csAccessAwayMes);
-
-// CCSDATA ccs;
-// PROTORECVEVENT pre;
-//
-// ccs.hContact = FindContact(cont->m_addr, cont->m_nick, false, true, cont->m_status);
-// ccs.szProtoService = PSS_AWAYMSG;
-// ccs.wParam = pak.idReqAwayMessage;
-// ccs.lParam = (LPARAM)"";
-//
-// pre.flags = 0;
-// pre.timestamp = get_time();
-// pre.szMessage = "Anus";
-// pre.lParam = ID_STATUS_AWAY;
-//
-// CallService(MS_PROTO_CHAINRECV, 0 ,(LPARAM)&ccs);
}
}
}
@@ -481,7 +451,7 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs)
ZeroMemory(&dbei,sizeof(dbei));
- if (ccs->szProtoService==PSR_MESSAGE)
+ if (ccs->szProtoService == PSR_MESSAGE)
dbei.eventType = EVENTTYPE_MESSAGE;
else
dbei.eventType = EVENTTYPE_URL;
@@ -1234,16 +1204,11 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock)
*pf_to++ = *pf_fr++;
*pf_to++ = *pf_fr++;
- conn->m_hContact = ccs.hContact = FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status);
- ccs.szProtoService = PSR_FILE;
- ccs.wParam = 0;
- ccs.lParam =(LPARAM)&pre;
-
+ conn->m_hContact = FindContact(cont->m_addr, cont->m_nick, true, false, false, cont->m_status);
pre.flags = 0;
pre.timestamp = get_time();
pre.lParam = 0;
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(conn->m_hContact, PSR_FILE, 0, (LPARAM)&pre);
delete[] pre.szMessage;
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 6d4cd2b76b..fa8e814bf9 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -404,16 +404,10 @@ void FacebookProto::ProcessUnreadMessages( void* )
}
PROTORECVEVENT recv = {0};
- CCSDATA ccs = {0};
-
recv.flags = PREF_UTF;
recv.szMessage = const_cast<char*>(message_text.c_str());
recv.timestamp = timestamp;
-
- ccs.hContact = hContact;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = reinterpret_cast<LPARAM>(&recv);
- CallService(MS_PROTO_CHAINRECV,0,reinterpret_cast<LPARAM>(&ccs));
+ ProtoChainRecvMsg(hContact, &recv);
pos3++;
}
@@ -461,16 +455,10 @@ void FacebookProto::ProcessMessages( void* data )
// TODO: maybe create new "receiveMsg" function and use it for offline and channel messages?
PROTORECVEVENT recv = {0};
- CCSDATA ccs = {0};
-
recv.flags = PREF_UTF;
recv.szMessage = const_cast<char*>(messages[i]->message_text.c_str());
recv.timestamp = local_timestamp ? ::time(NULL) : messages[i]->time;
-
- ccs.hContact = hContact;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = reinterpret_cast<LPARAM>(&recv);
- CallService(MS_PROTO_CHAINRECV,0,reinterpret_cast<LPARAM>(&ccs));
+ ProtoChainRecvMsg(hContact, &recv);
}
delete messages[i];
}
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 4c6b1faa59..acd2d89b74 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -845,15 +845,11 @@ retry:
// Check if not empty message ( who needs it? )
else if (!e->event.msg.recipients_count && e->event.msg.message && *e->event.msg.message && strcmp(e->event.msg.message, "\xA0\0"))
{
- CCSDATA ccs = {0};
PROTORECVEVENT pre = {0};
time_t t = time(NULL);
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = getcontact(e->event.msg.sender, 1, 0, NULL);
- ccs.lParam = (LPARAM)&pre;
pre.timestamp = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
pre.szMessage = e->event.msg.message;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ ProtoChainRecvMsg( getcontact(e->event.msg.sender, 1, 0, NULL), &pre);
}
// RichEdit format included (image)
@@ -1070,9 +1066,7 @@ retry:
pre.tszDescription = filenameT;
pre.ptszFiles = &filenameT;
pre.lParam = (LPARAM)dcc7;
-
- CCSDATA ccs = { dcc7->contact, PSR_FILE, 0, (LPARAM)&pre };
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(dcc7->contact, &pre);
mir_free(filenameT);
e->event.dcc7_new = NULL;
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index 3503b0bc9a..a111bbb022 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -392,9 +392,8 @@ void __cdecl GGPROTO::dccmainthread(void*)
pre.ptszFiles = &filenameT;
pre.lParam = (LPARAM)local_dcc;
- CCSDATA ccs = { local_dcc->contact, PSR_FILE, 0, (LPARAM)&pre };
gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1);
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(local_dcc->contact, &pre);
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
mir_free(filenameT);
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 9a6b934054..22d1f7fe14 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -851,18 +851,12 @@ int GGPROTO::img_displayasmsg(HANDLE hContact, void *img)
if (res != 0) {
char image_msg[MAX_PATH + 11];
- CCSDATA ccs = {0};
- PROTORECVEVENT pre = {0};
+ mir_snprintf(image_msg, SIZEOF(image_msg), "[img]%s[/img]", (char*)_T2A(szPath));
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.lParam = (LPARAM)&pre;
- char* szPathA = mir_t2a(szPath);
- mir_snprintf(image_msg, SIZEOF(image_msg), "[img]%s[/img]", szPathA);
- mir_free(szPathA);
+ PROTORECVEVENT pre = {0};
pre.timestamp = time(NULL);
pre.szMessage = image_msg;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ ProtoChainRecvMsg(hContact, &pre);
netlog("img_displayasmsg(): Image saved to %s.", szPath);
}
else
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 79d4579ae6..b176a01f00 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -705,11 +705,7 @@ bool CIrcProto::OnIrc_PRIVMSG( const CIrcMessage* pmsg )
bool bIsChannel = IsChannel(pmsg->parameters[0]);
if ( pmsg->m_bIncoming && !bIsChannel ) {
- CCSDATA ccs = {0};
- PROTORECVEVENT pre;
-
mess = DoColorCodes( mess.c_str(), TRUE, FALSE );
- ccs.szProtoService = PSR_MESSAGE;
struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false};
@@ -723,14 +719,15 @@ bool CIrcProto::OnIrc_PRIVMSG( const CIrcMessage* pmsg )
return true;
}
- ccs.hContact = CList_AddContact( &user, false, true );
- ccs.lParam = (LPARAM)&pre;
+ HANDLE hContact = CList_AddContact(&user, false, true);
+
+ PROTORECVEVENT pre;
pre.timestamp = (DWORD)time(NULL);
pre.flags = PREF_UTF;
pre.szMessage = mir_utf8encodeW( mess.c_str());
- setTString(ccs.hContact, "User", pmsg->prefix.sUser.c_str());
- setTString(ccs.hContact, "Host", pmsg->prefix.sHost.c_str());
- CallService( MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
+ setTString(hContact, "User", pmsg->prefix.sUser.c_str());
+ setTString(hContact, "Host", pmsg->prefix.sHost.c_str());
+ ProtoChainRecvMsg(hContact, &pre);
mir_free( pre.szMessage );
return true;
}
@@ -1180,12 +1177,7 @@ bool CIrcProto::IsCTCP( const CIrcMessage* pmsg )
pre.fileCount = 1;
pre.ptszFiles = &tszTemp;
pre.lParam = (LPARAM)di;
-
- CCSDATA ccs = {0};
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.lParam = (LPARAM) & pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(hContact, &pre);
} } }
// end type == "send"
}
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index c018b57a02..217861ba90 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -1368,18 +1368,10 @@ void CDccSession::DoChatReceive()
if ( *pStart ) {
// send it off to some messaging module
-
PROTORECVEVENT pre = {0};
pre.timestamp = (DWORD)time(NULL);
-// pre.szMessage = (char*)DoColorCodes((TCHAR*)pStart, true, false); //!!!! // remove color codes
pre.szMessage = pStart;
-
- CCSDATA ccs = {0};
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = di->hContact;
- ccs.lParam = (LPARAM) &pre;
-
- CallService( MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
+ ProtoChainRecvMsg(di->hContact, &pre);
}
cbInBuf -= pEnd - pStart;
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp
index 2398cf18c6..a4b8601e78 100644
--- a/protocols/IcqOscarJ/src/fam_02location.cpp
+++ b/protocols/IcqOscarJ/src/fam_02location.cpp
@@ -249,8 +249,6 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
oscar_tlv* pTLV;
BYTE *tmp;
char *szMsg = NULL;
- CCSDATA ccs;
- PROTORECVEVENT pre;
// Syntax check
if (wLen < 4)
@@ -266,22 +264,19 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
wLen -= (buf - tmp);
// Get extra chain
- if (pChain = readIntoTLVChain(&buf, wLen, 2))
- {
+ if (pChain = readIntoTLVChain(&buf, wLen, 2)) {
char* szEncoding = NULL;
// Get Away encoding TLV
pTLV = pChain->getTLV(0x03, 1);
- if (pTLV && (pTLV->wLen >= 1))
- {
+ if (pTLV && (pTLV->wLen >= 1)) {
szEncoding = (char*)_alloca(pTLV->wLen + 1);
memcpy(szEncoding, pTLV->pData, pTLV->wLen);
szEncoding[pTLV->wLen] = '\0';
}
// Get Away info TLV
pTLV = pChain->getTLV(0x04, 1);
- if (pTLV && (pTLV->wLen >= 1))
- {
+ if (pTLV && (pTLV->wLen >= 1)) {
szMsg = (char*)SAFE_MALLOC(pTLV->wLen + 2);
memcpy(szMsg, pTLV->pData, pTLV->wLen);
szMsg[pTLV->wLen] = '\0';
@@ -293,16 +288,12 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
disposeChain(&pChain);
}
- ccs.szProtoService = PSR_AWAYMSG;
- ccs.hContact = hContact;
- ccs.wParam = status;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre;
pre.flags = 0;
- pre.szMessage = szMsg?szMsg:(char *)"";
+ pre.szMessage = szMsg ? szMsg : (char *)"";
pre.timestamp = time(NULL);
pre.lParam = dwCookie;
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
SAFE_FREE((void**)&szMsg);
}
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp
index 7d1bc6a829..2a4766d1a8 100644
--- a/protocols/IcqOscarJ/src/fam_04message.cpp
+++ b/protocols/IcqOscarJ/src/fam_04message.cpp
@@ -265,7 +265,6 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char *
// different encodings (just like the new format of Offline Messages).
DWORD dwRecvTime;
char* szMsg = NULL;
- CCSDATA ccs;
PROTORECVEVENT pre = {0};
int bAdded;
@@ -392,21 +391,16 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char *
}
}
// Create and send the message event
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
pre.timestamp = dwRecvTime;
pre.szMessage = (char *)szMsg;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
NetLog_Server("Message (format 1) received");
// Save tick value
- setSettingDword(ccs.hContact, "TickTS", time(NULL) - (dwMsgID1/1000));
+ setSettingDword(hContact, "TickTS", time(NULL) - (dwMsgID1/1000));
}
- else
- NetLog_Server("Message (format %u) - Ignoring empty message", 1);
+ else NetLog_Server("Message (format %u) - Ignoring empty message", 1);
SAFE_FREE(&szMsg);
}
@@ -1203,23 +1197,17 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha
else
{
int bAdded;
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
-
hContact = HContactFromUID(dwUin, szUID, &bAdded);
// ack the message
icq_sendContactsAck(dwUin, szUID, dwID1, dwID2);
- ccs.szProtoService = PSR_CONTACTS;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre = {0};
pre.timestamp = (DWORD)time(NULL);
pre.szMessage = (char *)contacts;
pre.lParam = nContacts;
pre.flags = PREF_TCHAR;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
}
for (int i = 0; i < iContact; i++)
@@ -1636,37 +1624,27 @@ void packPluginTypeId(icq_packet *packet, int nTypeID)
void CIcqProto::handleStatusMsgReply(const char *szPrefix, HANDLE hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags)
{
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
-
- if (hContact == INVALID_HANDLE_VALUE)
- {
+ if (hContact == INVALID_HANDLE_VALUE) {
NetLog_Server("%sIgnoring status message from unknown contact %u", szPrefix, dwUin);
return;
}
int status = AwayMsgTypeToStatus(bMsgType);
- if (status == ID_STATUS_OFFLINE)
- {
+ if (status == ID_STATUS_OFFLINE) {
NetLog_Server("%sIgnoring unknown status message from %u", szPrefix, dwUin);
return;
}
// it is probably UTF-8 status reply
+ PROTORECVEVENT pre = {0};
if (wVersion == 9 || (nMsgFlags & MTF_PLUGIN) && wVersion == 10)
- {
- if (UTF8_IsValid(szMsg)) pre.flags |= PREF_UTF;
- }
+ if (UTF8_IsValid(szMsg))
+ pre.flags |= PREF_UTF;
- ccs.szProtoService = PSR_AWAYMSG;
- ccs.hContact = hContact;
- ccs.wParam = status;
- ccs.lParam = (LPARAM)&pre;
pre.szMessage = (char*)szMsg;
pre.timestamp = time(NULL);
pre.lParam = wCookie;
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
}
@@ -1783,7 +1761,6 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
case MTYPE_PLAIN: /* plain message */
{
- CCSDATA ccs;
PROTORECVEVENT pre = {0};
// Check if this message is marked as UTF8 encoded
@@ -1852,20 +1829,14 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
}
}
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
pre.timestamp = dwTimestamp;
pre.szMessage = (char *)szMsg;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
}
break;
case MTYPE_URL:
{
- CCSDATA ccs;
PROTORECVEVENT pre = {0};
if (nMsgFields < 2)
@@ -1890,15 +1861,10 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
SAFE_FREE(&szDataDescr);
SAFE_FREE(&szDataUrl);
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
pre.timestamp = dwTimestamp;
pre.szMessage = (char *)szBlob;
pre.flags = PREF_UTF;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
SAFE_FREE(&szBlob);
}
@@ -1907,22 +1873,15 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
case MTYPE_AUTHREQ: /* auth request */
/* format: nick FE first FE last FE email FE unk-char FE msg 00 */
{
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
char* szBlob;
char* pCurBlob;
-
- if (nMsgFields < 6)
- {
+ if (nMsgFields < 6) {
NetLog_Server("Malformed '%s' message", "auth req");
break;
}
- ccs.szProtoService=PSR_AUTH;
- ccs.hContact=hContact=HContactFromUIN(dwUin, &bAdded);
- ccs.wParam=0;
- ccs.lParam=(LPARAM)&pre;
+ PROTORECVEVENT pre = {0};
pre.timestamp=dwTimestamp;
pre.lParam=sizeof(DWORD)+sizeof(HANDLE)+strlennull(pszMsgField[0])+strlennull(pszMsgField[1])+strlennull(pszMsgField[2])+strlennull(pszMsgField[3])+strlennull(pszMsgField[5])+5;
@@ -1937,7 +1896,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
strcpy((char *)pCurBlob,pszMsgField[5]);
pre.szMessage=(char *)szBlob;
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
break;
@@ -1971,8 +1930,6 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
case MTYPE_CONTACTS:
{
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
char* pszNContactsEnd;
int nContacts;
int i;
@@ -2018,15 +1975,12 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
hContact = HContactFromUIN(dwUin, &bAdded);
sendMessageTypesAck(hContact, 0, pAckParams);
- ccs.szProtoService = PSR_CONTACTS;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre = {0};
pre.timestamp = dwTimestamp;
pre.szMessage = (char *)isrList;
pre.lParam = nContacts;
pre.flags = PREF_TCHAR;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
}
for (i = 0; i < nContacts; i++)
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp
index 5df30ee5ec..8afbe40c13 100644
--- a/protocols/IcqOscarJ/src/fam_13servclist.cpp
+++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp
@@ -1633,13 +1633,8 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
return;
HANDLE hContact = HContactFromUID(dwUin, szUid, &bAdded);
- CCSDATA ccs;
- PROTORECVEVENT pre;
- ccs.szProtoService = PSR_AUTH;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre;
pre.flags = 0;
pre.timestamp = time(NULL);
pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + 5;
@@ -1675,7 +1670,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
pre.lParam += nNickLen + nReasonLen;
- setSettingByte(ccs.hContact, "Grant", 1);
+ setSettingByte(hContact, "Grant", 1);
/*blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)*/
char *szBlob = (char *)_alloca(pre.lParam);
@@ -1691,8 +1686,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
*pCurBlob = 0; pCurBlob++; // FirstName
*pCurBlob = 0; pCurBlob++; // LastName
*pCurBlob = 0; pCurBlob++; // email
- if (nReasonLen)
- {
+ if (nReasonLen) {
memcpy(pCurBlob, szReason, nReasonLen);
pCurBlob += nReasonLen;
}
@@ -1700,7 +1694,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
pre.szMessage = szBlob;
// TODO: Change for new auth system, include all known informations
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
SAFE_FREE(&szNick);
SAFE_FREE(&szReason);
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp
index d85de72580..d466aaa0c6 100644
--- a/protocols/IcqOscarJ/src/icq_filerequests.cpp
+++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp
@@ -178,13 +178,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCoo
pre.tszDescription = mir_utf8decodeT(pszDescription);
pre.ptszFiles = &ptszFileName;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(hContact, &pre);
mir_free(pre.tszDescription);
mir_free(ptszFileName);
diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp
index f712cf6f87..be851f35d6 100644
--- a/protocols/IcqOscarJ/src/icq_xtraz.cpp
+++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp
@@ -371,21 +371,14 @@ void CIcqProto::handleXtrazData(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCo
strcat(szWork, szNum);
// Create message to notify user
- {
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
- int bAdded;
-
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = HContactFromUIN(dwUin, &bAdded);
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- pre.timestamp = time(NULL);
- pre.szMessage = szWork;
- pre.flags = PREF_UTF;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
- }
+ PROTORECVEVENT pre = {0};
+ pre.timestamp = time(NULL);
+ pre.szMessage = szWork;
+ pre.flags = PREF_UTF;
+
+ int bAdded;
+ ProtoChainRecvMsg( HContactFromUIN(dwUin, &bAdded), &pre);
+
SAFE_FREE(&szWork);
}
else
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index 9630abc070..d6723ded10 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -574,13 +574,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz
pre.tszDescription = mir_utf8decodeT(pszDescription);
pre.ptszFiles = &ptszFileName;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(hContact, &pre);
mir_free(pre.tszDescription);
mir_free(ptszFileName);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index eb4f9a58e7..240e6d4bef 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -371,8 +371,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
if ((n = xmlGetChild(fileNode , "desc")) != NULL)
pre.tszDescription = (TCHAR*)xmlGetText(n);
- CCSDATA ccs = { ft->std.hContact, PSR_FILE, 0, (LPARAM)&pre };
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(ft->std.hContact, &pre);
return;
}
else {
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 760267d5ee..ecf0064d61 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -722,9 +722,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
pre.ptszFiles = &str2;
pre.fileCount = 1;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs = { ft->std.hContact, PSR_FILE, 0, (LPARAM)&pre };
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(ft->std.hContact, &pre);
mir_free(str2);
}
else {
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 0604e9c3b1..b116a87ca6 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1508,12 +1508,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
recv.lParam = (LPARAM)AddToLastResourceMap(from);
LeaveCriticalSection(&m_csLastResourceMap);
- CCSDATA ccs;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM)&recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &recv);
mir_free((void*)szMessage);
mir_free(buf);
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp
index d63fcf6906..d4c05f9e04 100644
--- a/protocols/MRA/src/MraFilesQueue.cpp
+++ b/protocols/MRA/src/MraFilesQueue.cpp
@@ -733,14 +733,7 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags
prf.fileCount = 1;//dat->dwFilesCount;
prf.ptszFiles = &dat->pwszFilesList;
prf.lParam = dwIDRequest;
-
- CCSDATA ccs;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&prf;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(hContact, &prf);
return NO_ERROR;
}
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 243fda071c..fb441ea976 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -1735,11 +1735,8 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
LPSTR lpszMessageExt = NULL;
LPWSTR lpwszMessage = NULL;
size_t dwMessageSize = 0, dwMessageExtSize = 0;
- CCSDATA ccs = {0};
- PROTORECVEVENT pre = {0};
- //ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre = {0};
pre.timestamp = dwTime;
// check flags and datas
@@ -1915,15 +1912,15 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
mir_free(lpszMessageUTF);
}
else {
- ccs.hContact = MraHContactFromEmail(plpsFrom->lpszData, plpsFrom->dwSize, TRUE, TRUE, &bAdded);
+ HANDLE hContact = MraHContactFromEmail(plpsFrom->lpszData, plpsFrom->dwSize, TRUE, TRUE, &bAdded);
if (bAdded)
- MraUpdateContactInfo(ccs.hContact);
+ MraUpdateContactInfo(hContact);
// user typing
if (dwFlags & MESSAGE_FLAG_NOTIFY)
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)ccs.hContact, MAILRU_CONTACTISTYPING_TIMEOUT);
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, MAILRU_CONTACTISTYPING_TIMEOUT);
else { // text/contact/auth // typing OFF
- CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)ccs.hContact, PROTOTYPE_CONTACTTYPING_OFF);
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, PROTOTYPE_CONTACTTYPING_OFF);
if (dwFlags & MESSAGE_FLAG_MULTICHAT) {
LPBYTE lpbMultiChatData, lpbDataCurrent;
@@ -1941,12 +1938,12 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
switch (dwMultiChatEventType) {
case MULTICHAT_MESSAGE:
- MraChatSessionMessageAdd(ccs.hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, lpwszMessage, dwMessageSize, dwTime);// LPS sender
+ MraChatSessionMessageAdd(hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, lpwszMessage, dwMessageSize, dwTime);// LPS sender
break;
case MULTICHAT_ADD_MEMBERS:
- MraChatSessionMembersAdd(ccs.hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS sender
+ MraChatSessionMembersAdd(hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS sender
GetLPS(lpbMultiChatData, dwMultiChatDataSize, &lpbDataCurrent, &lpsString);// CLPS members
- MraChatSessionSetIviter(ccs.hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize);
+ MraChatSessionSetIviter(hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize);
case MULTICHAT_MEMBERS:
{
LPBYTE lpbMultiChatDataLocal, lpbDataCurrentLocal;
@@ -1961,23 +1958,23 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
dwMultiChatMembersCount = GetUL(&lpbDataCurrentLocal);// count
for (i = 0; i < dwMultiChatMembersCount; i++)
if (GetLPS(lpbMultiChatDataLocal, dwMultiChatDataLocalSize, &lpbDataCurrentLocal, &lpsString) == NO_ERROR)
- MraChatSessionJoinUser(ccs.hContact, lpsString.lpszData, lpsString.dwSize, ((dwMultiChatEventType == MULTICHAT_MEMBERS)? 0:dwTime));
+ MraChatSessionJoinUser(hContact, lpsString.lpszData, lpsString.dwSize, ((dwMultiChatEventType == MULTICHAT_MEMBERS)? 0:dwTime));
if (dwMultiChatEventType == MULTICHAT_MEMBERS) {
GetLPS(lpbMultiChatData, dwMultiChatDataSize, &lpbDataCurrent, &lpsEMailInMultiChat);// [ LPS owner ]
- MraChatSessionSetOwner(ccs.hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize);
+ MraChatSessionSetOwner(hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize);
}
}
break;
case MULTICHAT_ATTACHED:
- MraChatSessionJoinUser(ccs.hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS member
+ MraChatSessionJoinUser(hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS member
break;
case MULTICHAT_DETACHED:
- MraChatSessionLeftUser(ccs.hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS member
+ MraChatSessionLeftUser(hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS member
break;
case MULTICHAT_INVITE:
- MraChatSessionInvite(ccs.hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS sender
- MraAddContactW(ccs.hContact, (CONTACT_FLAG_VISIBLE|CONTACT_FLAG_MULTICHAT|CONTACT_FLAG_UNICODE_NAME), -1, plpsFrom->lpszData, plpsFrom->dwSize, lpsMultichatName.lpwszData, (lpsMultichatName.dwSize/sizeof(WCHAR)), NULL, 0, NULL, 0, 0);
+ MraChatSessionInvite(hContact, lpsEMailInMultiChat.lpszData, lpsEMailInMultiChat.dwSize, dwTime);// LPS sender
+ MraAddContactW(hContact, (CONTACT_FLAG_VISIBLE|CONTACT_FLAG_MULTICHAT|CONTACT_FLAG_UNICODE_NAME), -1, plpsFrom->lpszData, plpsFrom->dwSize, lpsMultichatName.lpwszData, (lpsMultichatName.dwSize/sizeof(WCHAR)), NULL, 0, NULL, 0, 0);
break;
default:
DebugBreak();
@@ -1992,7 +1989,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
bAutoGrantAuth = FALSE;
else {
// temporary contact
- if (db_get_b(ccs.hContact, "CList", "NotOnList", 0)) {
+ if (db_get_b(hContact, "CList", "NotOnList", 0)) {
if (mraGetByte(NULL, "AutoAuthGrandNewUsers", MRA_DEFAULT_AUTO_AUTH_GRAND_NEW_USERS))
bAutoGrantAuth = TRUE;
}
@@ -2001,7 +1998,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
}
if (bAdded)
- DBWriteContactSettingByte(ccs.hContact, "CList", "Hidden", 1);
+ DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
if (bAutoGrantAuth) { // auto grant auth
DBEVENTINFO dbei = {0};
@@ -2013,26 +2010,24 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.pBlob = (PBYTE)btBuff;
- CreateBlobFromContact(ccs.hContact, lpwszMessage, dwMessageSize, btBuff, SIZEOF(btBuff), (size_t*)&dbei.cbBlob);
+ CreateBlobFromContact(hContact, lpwszMessage, dwMessageSize, btBuff, SIZEOF(btBuff), (size_t*)&dbei.cbBlob);
CallService(MS_DB_EVENT_ADD, 0, (LPARAM)&dbei);
MraAuthorize(plpsFrom->lpszData, plpsFrom->dwSize);
}
else {
- ccs.szProtoService = PSR_AUTH;
pre.szMessage = (LPSTR)btBuff;
- CreateBlobFromContact(ccs.hContact, lpwszMessage, dwMessageSize, btBuff, SIZEOF(btBuff), (size_t*)&pre.lParam);
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ CreateBlobFromContact(hContact, lpwszMessage, dwMessageSize, btBuff, SIZEOF(btBuff), (size_t*)&pre.lParam);
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
}
else {
- DBDeleteContactSetting(ccs.hContact, "CList", "Hidden");
+ DBDeleteContactSetting(hContact, "CList", "Hidden");
if (dwFlags & MESSAGE_FLAG_CONTACT) { // contacts received
LPBYTE lpbBuffer, lpbBufferCurPos;
lpbBuffer = (LPBYTE)mir_calloc((dwMessageSize+MAX_PATH));
if (lpbBuffer) {
- ccs.szProtoService = PSR_CONTACTS;
pre.flags = 0;
pre.szMessage = (LPSTR)lpbBuffer;
pre.lParam = WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszMessage, dwMessageSize, (LPSTR)lpbBuffer, (dwMessageSize+MAX_PATH), NULL, NULL);
@@ -2047,20 +2042,18 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
(*lpbBufferCurPos) = 0;
lpbBufferCurPos++;
}
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
mir_free(lpbBuffer);
}
else dwRetErrorCode = GetLastError();
}
else if (dwFlags & MESSAGE_FLAG_ALARM) { // alarm
if (heNudgeReceived)
- NotifyEventHooks(heNudgeReceived, (WPARAM)ccs.hContact, NULL);
+ NotifyEventHooks(heNudgeReceived, (WPARAM)hContact, NULL);
else {
pre.flags = 0;
pre.szMessage = (LPSTR)TranslateTS(MRA_ALARM_MESSAGE);
- //pre.lParam = lstrlenA(pre.szMessage);
- ccs.szProtoService = PSR_MESSAGE;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
}
}
else { // standart message// flash animation
@@ -2068,9 +2061,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
if ((dwFlags & MESSAGE_FLAG_RTF) && (dwFlags & MESSAGE_FLAG_FLASH) == 0 && lpszMessageExt && dwMessageExtSize && mraGetByte(NULL, "RTFReceiveEnable", MRA_DEFAULT_RTF_RECEIVE_ENABLE)) {
pre.flags = 0;
pre.szMessage = lpszMessageExt;
- //pre.lParam = dwMessageExtSize;
- ccs.szProtoService = PSR_MESSAGE;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
}
else {
// some plugins can change pre.szMessage pointer and we failed to free it
@@ -2079,15 +2070,14 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
pre.szMessage = lpszMessageUTF;
pre.flags = PREF_UTF;
WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, dwMessageSize, lpszMessageUTF, ((dwMessageSize+MAX_PATH)*sizeof(WCHAR)), NULL, NULL);
- ccs.szProtoService = PSR_MESSAGE;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
mir_free(lpszMessageUTF);
}
else dwRetErrorCode = GetLastError();
}
if (dwFlags & MESSAGE_FLAG_SYSTEM)
- MraPopupShowW(ccs.hContact, MRA_POPUP_TYPE_INFORMATION, 0, TranslateW(L"Mail.ru System notify"), (LPWSTR)pre.szMessage);
+ MraPopupShowW(hContact, MRA_POPUP_TYPE_INFORMATION, 0, TranslateW(L"Mail.ru System notify"), (LPWSTR)pre.szMessage);
}
}
}
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 5a239dd986..743094b0dc 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -155,13 +155,7 @@ void CMsnProto::sttInviteMessage(ThreadData* info, char* msgBody, char* email, c
pre.tszDescription = tComment;
pre.ptszFiles = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.hContact = ft->std.hContact;
- ccs.szProtoService = PSR_FILE;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(ft->std.hContact, &pre);
return;
}
@@ -440,9 +434,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
if (!_strnicmp(tContentType, "text/plain", 10))
{
- CCSDATA ccs = {0};
-
- ccs.hContact = MSN_HContactFromEmail(email, nick, true, true);
+ HANDLE hContact = MSN_HContactFromEmail(email, nick, true, true);
const char* p = tHeader["X-MMS-IM-Format"];
bool isRtl = p != NULL && strstr(p, "RL=1") != NULL;
@@ -457,7 +449,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
{
if (_stricmp(info->mJoinedContactsWLID[j], email) == 0 && j != 0)
{
- ccs.hContact = info->getContactHandle();
+ hContact = info->getContactHandle();
break;
}
}
@@ -469,8 +461,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
parseWLID(NEWSTR_ALLOCA(email), NULL, &szEmail, NULL);
sentMsg = _stricmp(szEmail, MyOptions.szEmail) == 0;
if (sentMsg)
- ccs.hContact = ubmMsg ? MSN_HContactFromEmail(datau.toEmail, nick) :
- info->getContactHandle();
+ hContact = ubmMsg ? MSN_HContactFromEmail(datau.toEmail, nick) : info->getContactHandle();
}
const char* tP4Context = tHeader["P4-Context"];
@@ -493,7 +484,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
gce.pDest = &gcd;
gce.ptszUID = mir_a2t(email);
- gce.ptszNick = GetContactNameT(ccs.hContact);
+ gce.ptszNick = GetContactNameT(hContact);
gce.time = time(NULL);
gce.bIsMe = FALSE;
@@ -505,29 +496,24 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
mir_free((void*)gce.pszText);
mir_free((void*)gce.ptszUID);
}
- else if (ccs.hContact)
+ else if (hContact)
{
if (!sentMsg)
{
- CallService(MS_PROTO_CONTACTISTYPING, WPARAM(ccs.hContact), 0);
+ CallService(MS_PROTO_CONTACTISTYPING, WPARAM(hContact), 0);
PROTORECVEVENT pre;
pre.szMessage = (char*)msgBody;
pre.flags = PREF_UTF + (isRtl ? PREF_RTL : 0);
pre.timestamp = (DWORD)time(NULL);
pre.lParam = 0;
-
- ccs.szProtoService = PSR_MESSAGE;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
}
else
{
- DBEVENTINFO dbei = {0};
-
- bool haveWnd = MSN_MsgWndExist(ccs.hContact);
+ bool haveWnd = MSN_MsgWndExist(hContact);
+ DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF | (haveWnd ? 0 : DBEF_READ) | (isRtl ? DBEF_RTL : 0);
@@ -535,7 +521,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
dbei.timestamp = time(NULL);
dbei.cbBlob = (unsigned)strlen(msgBody) + 1;
dbei.pBlob = (PBYTE)msgBody;
- CallService(MS_DB_EVENT_ADD, (WPARAM)ccs.hContact, (LPARAM)&dbei);
+ CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
}
}
}
@@ -979,13 +965,7 @@ void CMsnProto::sttProcessPage(char* buf, unsigned len)
pre.szMessage = (char*)szMsg;
pre.flags = PREF_UTF /*+ ((isRtl) ? PREF_RTL : 0)*/;
pre.timestamp = time(NULL);
-
- CCSDATA ccs = {0};
- ccs.hContact = MSN_HContactFromEmail(szTel, szTel, true, true);
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
-
+ ProtoChainRecvMsg( MSN_HContactFromEmail(szTel, szTel, true, true), &pre);
}
ezxml_free(xmlnot);
}
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index 869642d1d4..c5e0b593d1 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -121,12 +121,7 @@ void CMsnProto::getOIMs(ezxml_t xmli)
pre.szMessage = mailInfo.decodeMailBody((char*)mailbody);
pre.flags = PREF_UTF /*+ ((isRtl) ? PREF_RTL : 0)*/;
pre.timestamp = evtm;
-
- CCSDATA ccs = {0};
- ccs.hContact = MSN_HContactFromEmail(szEmail);
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg( MSN_HContactFromEmail(szEmail), &pre);
mir_free(pre.szMessage);
ezxml_t delmid = ezxml_add_child(delmids, "messageId", 0);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 5599ce3b22..0695989eb9 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -96,17 +96,11 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const c
if (reason == NULL) reason = "";
int reasonlen = (int)strlen(reason);
- CCSDATA ccs = { 0 };
PROTORECVEVENT pre = { 0 };
-
pre.flags = PREF_UTF;
pre.timestamp = (DWORD)time(NULL);
pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + nicklen + emaillen + 5 + reasonlen;
- ccs.szProtoService = PSR_AUTH;
- ccs.hContact = hContact;
- ccs.lParam = (LPARAM)&pre;
-
char* pCurBlob = (char*)alloca(pre.lParam);
pre.szMessage = pCurBlob;
@@ -118,7 +112,7 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const c
strcpy(pCurBlob, email); pCurBlob += emaillen + 1; // E-mail
strcpy(pCurBlob, reason); // Reason
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp
index 599dee57fd..3a7a6c4429 100644
--- a/protocols/MSN/src/msn_p2p.cpp
+++ b/protocols/MSN/src/msn_p2p.cpp
@@ -1329,13 +1329,7 @@ void CMsnProto::p2p_InitFileTransfer(
pre.tszDescription = tComment;
pre.ptszFiles = &ft->std.tszCurrentFile;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.hContact = ft->std.hContact;
- ccs.szProtoService = PSR_FILE;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(ft->std.hContact, &pre);
}
break;
diff --git a/protocols/NewsAggregator/Src/Utils.cpp b/protocols/NewsAggregator/Src/Utils.cpp
index 90ce3cc2d9..f28825d7e5 100644
--- a/protocols/NewsAggregator/Src/Utils.cpp
+++ b/protocols/NewsAggregator/Src/Utils.cpp
@@ -1090,13 +1090,7 @@ VOID CheckCurrentFeed(HANDLE hContact)
recv.flags = PREF_TCHAR;
recv.timestamp = stamp;
recv.tszMessage = message;
-
- CCSDATA ccs;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = ( LPARAM )&recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &recv);
}
mir_free(message);
}
@@ -1389,13 +1383,7 @@ VOID CheckCurrentFeed(HANDLE hContact)
recv.flags = PREF_TCHAR;
recv.timestamp = stamp;
recv.tszMessage = message;
-
- CCSDATA ccs;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = ( LPARAM )&recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &recv);
}
mir_free(message);
}
diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp
index 1250c2aa13..291d1208a5 100644
--- a/protocols/Tlen/src/jabber_thread.cpp
+++ b/protocols/Tlen/src/jabber_thread.cpp
@@ -610,7 +610,6 @@ static void TlenProcessAvatar(XmlNode* node, ThreadData *info)
static void JabberProcessMessage(XmlNode *node, ThreadData *info)
{
HANDLE hContact;
- CCSDATA ccs;
PROTORECVEVENT recv;
XmlNode *bodyNode, *subjectNode, *xNode, *n;
char *from, *type, *nick, *p, *localMessage, *idStr;
@@ -732,12 +731,7 @@ static void JabberProcessMessage(XmlNode *node, ThreadData *info)
recv.timestamp = (DWORD) msgTime;
recv.szMessage = localMessage;
recv.lParam = 0;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM) &recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
-
+ ProtoChainRecvMsg(hContact, &recv);
mir_free(localMessage);
}
}
@@ -982,7 +976,6 @@ static void JabberProcessIq(XmlNode *node, ThreadData *info)
static void TlenProcessW(XmlNode *node, ThreadData *info)
{
HANDLE hContact;
- CCSDATA ccs;
PROTORECVEVENT recv;
char *f, *e, *s, *body;
char *str, *localMessage;
@@ -1019,11 +1012,7 @@ static void TlenProcessW(XmlNode *node, ThreadData *info)
recv.timestamp = (DWORD) time(NULL);
recv.szMessage = localMessage;
recv.lParam = 0;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM) &recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ ProtoChainRecvMsg(hContact, &recv);
mir_free(localMessage);
mir_free(str);
@@ -1036,7 +1025,6 @@ static void TlenProcessW(XmlNode *node, ThreadData *info)
static void TlenProcessM(XmlNode *node, ThreadData *info)
{
HANDLE hContact;
- CCSDATA ccs;
PROTORECVEVENT recv;
char *f;//, *from;//username
char *tp;//typing start/stop
@@ -1111,11 +1099,7 @@ static void TlenProcessM(XmlNode *node, ThreadData *info)
recv.timestamp = (DWORD) timestamp;
recv.szMessage = localMessage;
recv.lParam = 0;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.lParam = (LPARAM) &recv;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ ProtoChainRecvMsg(hContact, &recv);
mir_free(localMessage);
} else {
/* MUC message */
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp
index 4a02259245..856b852292 100644
--- a/protocols/Tlen/src/tlen_file.cpp
+++ b/protocols/Tlen/src/tlen_file.cpp
@@ -615,8 +615,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info)
pre.ptszFiles = &filenameT;
pre.lParam = (LPARAM)ft;
JabberLog(ft->proto, "sending chainrecv");
- CCSDATA ccs = { ft->hContact, PSR_FILE, 0, (LPARAM)&pre };
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ ProtoChainRecvFile(ft->hContact, &pre);
mir_free(filenameT);
} else {
// malformed <f/> request, reject
diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp
index 35584f277a..c4582f72b2 100644
--- a/protocols/Tlen/src/tlen_p2p_new.cpp
+++ b/protocols/Tlen/src/tlen_p2p_new.cpp
@@ -270,8 +270,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) {
pre.ptszFiles = &filenameT;
pre.lParam = (LPARAM)ft;
JabberLog(ft->proto, "sending chainrecv");
- CCSDATA ccs = { ft->hContact, PSR_FILE, 0, (LPARAM)&pre };
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ ProtoChainRecvFile(ft->hContact, &pre);
mir_free(filenameT);
}
} else if (!strcmp(e, "3")) {
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 443bddc77f..fe18ae5c76 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -657,19 +657,12 @@ void TwitterProto::UpdateMessages(bool pre_read)
HANDLE hContact = AddToClientList(i->username.c_str(),"");
PROTORECVEVENT recv = {};
- CCSDATA ccs = {};
-
recv.flags = PREF_UTF;
if(pre_read)
recv.flags |= PREF_CREATEREAD;
recv.szMessage = const_cast<char*>(i->status.text.c_str());
recv.timestamp = static_cast<DWORD>(i->status.time);
-
- ccs.hContact = hContact;
- ccs.szProtoService = PSR_MESSAGE;
- ccs.wParam = ID_STATUS_ONLINE;
- ccs.lParam = reinterpret_cast<LPARAM>(&recv);
- CallService(MS_PROTO_CHAINRECV,0,reinterpret_cast<LPARAM>(&ccs));
+ ProtoChainRecvMsg(hContact, &recv);
}
db_pod_set(0,m_szModuleName,TWITTER_KEY_DMSINCEID,dm_since_id_);
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index c1cb8b7f61..9b6af47d47 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -626,25 +626,17 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
HANDLE handle=CList_AddContact(xfire_newc,TRUE,TRUE,0);
if(handle) { // invite nachricht mitsenden
- string str;
- CCSDATA ccs;
- PROTORECVEVENT pre;
-
- str=(char*)invite->msg.c_str();
+ string str = (char*)invite->msg.c_str();
- time_t t = time(NULL);
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = handle;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM) & pre;
+ PROTORECVEVENT pre;
pre.flags = 0;
- pre.timestamp = t;
+ pre.timestamp = time(NULL);
pre.szMessage = (char*)mir_utf8decode((char*)str.c_str(),NULL);
//invite nachricht konnte nicht zugewiesen werden?!?!?!
if(!pre.szMessage)
pre.szMessage=(char*)str.c_str();
pre.lParam = 0;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ ProtoChainRecvMsg(handle, &pre);
}
}
else
@@ -731,41 +723,29 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
//ne nachricht für mich, juhu
case XFIRE_MESSAGE_ID: {
string str;
- CCSDATA ccs;
- PROTORECVEVENT pre;
if( (( MessagePacket*)content)->getMessageType() == 0){
BuddyListEntry *entry = client->getBuddyList()->getBuddyBySid( ((MessagePacket*)content)->getSid() );
if(entry!=NULL)
{
str=((MessagePacket*)content)->getMessage();
- time_t t = time(NULL);
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = entry->hcontact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM) & pre;
- pre.flags = 0;
- pre.timestamp = t;
- if(this->useutf8)
- {
+
+ PROTORECVEVENT pre = { 0 };
+ pre.timestamp = time(NULL);
+ if (this->useutf8) {
pre.szMessage = (char*)str.c_str();
pre.flags = PREF_UTF;
}
- else
- pre.szMessage = (char*)mir_utf8decode((char*)str.c_str(),NULL);
- pre.lParam = 0;
-
- CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)ccs.hContact,PROTOTYPE_CONTACTTYPING_OFF);
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
+ else pre.szMessage = (char*)mir_utf8decode((char*)str.c_str(),NULL);
+ CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)entry->hcontact,PROTOTYPE_CONTACTTYPING_OFF);
+ ProtoChainRecvMsg(entry->hcontact, &pre);
}
}
else if( (( MessagePacket*)content)->getMessageType() == 3) {
BuddyListEntry *entry = client->getBuddyList()->getBuddyBySid( ((MessagePacket*)content)->getSid() );
if(entry!=NULL)
- {
CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)entry->hcontact,5);
- }
}
break;
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp
index d7dd38b9e3..1ba54f6ddd 100644
--- a/protocols/Xfire/src/variables.cpp
+++ b/protocols/Xfire/src/variables.cpp
@@ -172,7 +172,7 @@ char* XFireGetFoldersPath(char * pathtype)
extern HANDLE XFireWorkingFolder;
extern HANDLE XFireIconFolder;
extern HANDLE XFireAvatarFolder;
- char path[1024] = "";
+ static char path[1024]; path[0] = 0;
if (ServiceExists(MS_FOLDERS_REGISTER_PATH)){
if (!strcmp(pathtype,"Avatar")){
FoldersGetCustomPath(XFireAvatarFolder, path, 1024, "" );}
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp
index be896a4363..0cc2f4ba8c 100644
--- a/protocols/Yahoo/src/file_transfer.cpp
+++ b/protocols/Yahoo/src/file_transfer.cpp
@@ -529,13 +529,7 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url,
pre.tszDescription = mir_a2t(msg);
pre.ptszFiles = &ptszFileName;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM) & pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
+ ProtoChainRecvFile(hContact, &pre);
mir_free(pre.tszDescription);
mir_free(ptszFileName);
@@ -585,13 +579,7 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_
pre.tszDescription = _T("");
pre.ptszFiles = &ptszFileName;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = ft->hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
+ ProtoChainRecvFile(ft->hContact, &pre);
mir_free(ptszFileName);
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp
index 5e28ec9d5f..7b8b8b1ea1 100644
--- a/protocols/Yahoo/src/im.cpp
+++ b/protocols/Yahoo/src/im.cpp
@@ -34,7 +34,6 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
char *umsg;
const char *c = msg;
int oidx = 0;
- CCSDATA ccs;
PROTORECVEVENT pre;
HANDLE hContact;
@@ -104,16 +103,9 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
/* Need to strip off formatting stuff first. Then do all decoding/converting */
LOG(("%s: %s", who, umsg));
- //if (!strcmp(umsg, "<ding>"))
- // :P("\a");
-
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact = add_buddy(who, who, protocol, PALF_TEMPORARY);
//SetWord(hContact, "yprotoid", protocol);
Set_Protocol(hContact, protocol);
- ccs.wParam = 0;
- ccs.lParam = (LPARAM) &pre;
pre.flags = (utf8) ? PREF_UTF : 0;
if (tm) {
@@ -144,7 +136,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
// Turn off typing
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF);
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
+ ProtoChainRecvMsg(hContact, &pre);
// ack the message we just got
if (seqn)
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 54e0ed3005..a99136403a 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -799,37 +799,36 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status
void CYahooProto::ext_contact_added(const char *myid, const char *who, const char *fname, const char *lname, const char *msg, int protocol)
{
- char nick[128];
- BYTE *pCurBlob;
- HANDLE hContact = NULL;
- CCSDATA ccs = { 0 };
+ char nick[128];
+ BYTE *pCurBlob;
+ HANDLE hContact = NULL;
PROTORECVEVENT pre = { 0 };
/* NOTE: Msg is actually in UTF8 unless stated otherwise!! */
- LOG(("[ext_contact_added] %s %s (%s:%d) added you as %s w/ msg '%s'", fname, lname, who, protocol, myid, msg));
-
+ LOG(("[ext_contact_added] %s %s (%s:%d) added you as %s w/ msg '%s'", fname, lname, who, protocol, myid, msg));
+
if ( BuddyIgnored( who )) {
LOG(("User '%s' on our Ignore List. Dropping Authorization Request.", who));
return;
}
-
+
nick[0] = '\0';
-
+
if (lname && fname)
mir_snprintf(nick, sizeof(nick), "%s %s", fname, lname);
else if (lname)
mir_snprintf(nick, sizeof(nick), "%s", lname);
else if (fname)
mir_snprintf(nick, sizeof(nick), "%s", fname);
-
+
if (nick[0] == '\0')
mir_snprintf(nick, sizeof(nick), "%s", who);
-
+
if (fname) SetStringUtf(hContact, "FirstName", fname);
if (lname) SetStringUtf(hContact, "LastName", lname);
hContact = add_buddy(who, nick, protocol, PALF_TEMPORARY);
-
+
if (strcmp(nick, who) != 0)
SetStringUtf(hContact, "Nick", nick);
@@ -840,14 +839,10 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha
//SetWord(hContact, "yprotoid", protocol);
Set_Protocol(hContact, protocol);
-
- ccs.szProtoService = PSR_AUTH;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM) &pre;
+
pre.flags = PREF_UTF;
pre.timestamp = time(NULL);
-
+
pre.lParam = sizeof(DWORD)+sizeof(HANDLE)+lstrlenA(who)+lstrlenA(nick)+5;
if (fname != NULL)
@@ -862,14 +857,6 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha
pCurBlob=(PBYTE)malloc(pre.lParam);
pre.szMessage = (char *)pCurBlob;
- /*
- Auth blob is: uin(DWORD),hcontact(HANDLE),nick(ASCIIZ),first(ASCIIZ),
- last(ASCIIZ),email(ASCIIZ),reason(ASCIIZ)
-
- blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), fname (ASCIIZ), lname (ASCIIZ), email(ASCIIZ), msg(ASCIIZ)
-
- */
-
// UIN
*( PDWORD )pCurBlob = 0;
pCurBlob+=sizeof(DWORD);
@@ -896,9 +883,9 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha
pCurBlob+=lstrlenA((char *)pCurBlob)+1;
// Reason
- lstrcpyA((char *)pCurBlob, (msg != NULL) ? msg : "" );
+ lstrcpyA((char *)pCurBlob, (msg != NULL) ? msg : "");
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
void CYahooProto::ext_typing_notify(const char *me, const char *who, int protocol, int stat)
@@ -936,38 +923,37 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con
[17:36:44 YAHOO]
[17:36:44 YAHOO] libyahoo2/libyahoo2.c:908: debug:
[17:36:44 YAHOO] [Reading packet done]
-
- */
- LOG(("[ext_game_notify] me: %s, who: %s, stat: %d, msg: %s", me, who, stat, msg));
- /* FIXME - Not Implemented - this informs you someone else is playing on Yahoo! Games */
- /* Also Stubbed in Sample Client */
+*/
+ LOG(("[ext_game_notify] me: %s, who: %s, stat: %d, msg: %s", me, who, stat, msg));
+ /* FIXME - Not Implemented - this informs you someone else is playing on Yahoo! Games */
+ /* Also Stubbed in Sample Client */
HANDLE hContact = getbuddyH(who);
if (!hContact)
return;
-
+
if (stat == 2)
SetString(hContact, "YGMsg", "");
else if (msg) {
const char *l = msg, *u = NULL;
char *z, *c;
int i = 0;
-
+
/* Parse and Set a custom Message
- *
- * Format: 1 [09] ygamesp [09] 1 [09] 0 [09] ante?room=yahoo_1078798506&follow=rrrrrrr
- * [09] Yahoo! Poker\nRoom: Intermediate Lounge 2
- *
- * Sign-in:
- * [17:13:42 YAHOO] [ext_yahoo_game_notify] id: 1, me: xxxxx, who: rrrrrrr,
- * stat: 1, msg: 1 ygamesa 1 0 ante?room=yahoo_1043183792&follow=lotesdelere
- * Yahoo! Backgammon Room: Social Lounge 12
- *
- * Sign-out:
- * [17:18:38 YAHOO] [ext_yahoo_game_notify] id: 1, me: xxxxx, who: rrrrr,
- * stat: 2, msg: 1 ygamesa 2
- */
+ *
+ * Format: 1 [09] ygamesp [09] 1 [09] 0 [09] ante?room=yahoo_1078798506&follow=rrrrrrr
+ * [09] Yahoo! Poker\nRoom: Intermediate Lounge 2
+ *
+ * Sign-in:
+ * [17:13:42 YAHOO] [ext_yahoo_game_notify] id: 1, me: xxxxx, who: rrrrrrr,
+ * stat: 1, msg: 1 ygamesa 1 0 ante?room=yahoo_1043183792&follow=lotesdelere
+ * Yahoo! Backgammon Room: Social Lounge 12
+ *
+ * Sign-out:
+ * [17:18:38 YAHOO] [ext_yahoo_game_notify] id: 1, me: xxxxx, who: rrrrr,
+ * stat: 2, msg: 1 ygamesa 2
+ */
z = (char *) _alloca(lstrlenA(l) + 50);
-
+
z[0]='\0';
do{
c = ( char* )strchr(l, 0x09);
@@ -979,12 +965,12 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con
u = l;
}
} while (c != NULL && i < 5);
-
+
if (c != NULL) {
// insert \r before \n
do{
c = ( char* )strchr(l, '\n');
-
+
if (c != NULL) {
(*c) = '\0';
lstrcatA(z, l);
@@ -994,15 +980,15 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con
lstrcatA(z, l);
}
} while (c != NULL);
-
+
lstrcatA(z, "\r\n\r\nhttp://games.yahoo.com/games/");
lstrcatA(z, u);
c = strchr(z, 0x09);
(*c) = '\0';
}
-
+
SetStringUtf(hContact, "YGMsg", z);
-
+
} else {
/* ? no information / reset custom message */
SetString(hContact, "YGMsg", "");