diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-28 17:38:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-28 17:38:49 +0000 |
commit | 5e9e63c45e37917ffb0acd83832d0d8f99d01883 (patch) | |
tree | 1b674b85b1f582a13bd2a57ec73377b8989141bc /protocols/AimOscar/src | |
parent | 7105dcf75bdd939ca52ba045bc29c536c3f7ba49 (diff) |
new macroses for MS_PROTO_CHAINRECV: ProtoChainRecv, ProtoChainRecvMsg & ProtoChainRecvFile
git-svn-id: http://svn.miranda-ng.org/main/trunk@2540 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/AimOscar/src')
-rw-r--r-- | protocols/AimOscar/src/avatars.cpp | 6 | ||||
-rw-r--r-- | protocols/AimOscar/src/client.cpp | 4 | ||||
-rw-r--r-- | protocols/AimOscar/src/connection.cpp | 72 | ||||
-rw-r--r-- | protocols/AimOscar/src/conv.cpp | 56 | ||||
-rw-r--r-- | protocols/AimOscar/src/flap.cpp | 6 | ||||
-rw-r--r-- | protocols/AimOscar/src/proto.cpp | 8 | ||||
-rw-r--r-- | protocols/AimOscar/src/server.cpp | 336 | ||||
-rw-r--r-- | protocols/AimOscar/src/snac.cpp | 4 | ||||
-rw-r--r-- | protocols/AimOscar/src/tlv.cpp | 2 | ||||
-rw-r--r-- | protocols/AimOscar/src/ui.cpp | 42 | ||||
-rw-r--r-- | protocols/AimOscar/src/utility.cpp | 4 |
11 files changed, 240 insertions, 300 deletions
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)⪯
- 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)⪯
- 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)
|