--- ysmv7_2_9_7/src/YSM_Network.c 2006-07-05 22:33:31.000000000 -0400 +++ ysmv7_2_9_8/src/YSM_Network.c 2006-07-05 22:44:28.000000000 -0400 @@ -1,4 +1,4 @@ -/* $Id: YSM_Network.c,v 1.215 2005/12/26 23:44:58 rad2k Exp $ */ +/* $Id: YSM_Network.c,v 1.216 2006/02/12 17:14:49 rad2k Exp $ */ /* -======================== ysmICQ client ============================- Having fun with a boring Protocol @@ -26,7 +26,7 @@ */ #include "YSM.h" -__RCSID("$Id: YSM_Network.c,v 1.215 2005/12/26 23:44:58 rad2k Exp $"); +__RCSID("$Id: YSM_Network.c,v 1.216 2006/02/12 17:14:49 rad2k Exp $"); #include "YSM_ICQv7.h" #include "YSM_Lists.h" @@ -48,7 +48,7 @@ extern time_t YSM_LastKA; int32_t -YSM_NetworkInit( void ) + YSM_NetworkInit( void ) { /* zero all sinfo fields */ memset(&g_sinfo, 0, sizeof(struct YSM_SERVERINFORMATION)); @@ -66,9 +66,9 @@ } int32_t -YSM_HostToAddress( int8_t *inhost, u_int32_t *outaddress ) + YSM_HostToAddress( int8_t *inhost, u_int32_t *outaddress ) { -struct hostent *myhostent; + struct hostent *myhostent; #if !defined(WIN32) && !defined(_AIX) && !defined(__sun__) && !defined(sun) struct in_addr myaddr; int32_t retval = 0; @@ -109,14 +109,14 @@ #endif return 0; -} + } -int32_t -YSM_RawConnect( int8_t *host, u_int16_t port ) -{ -struct sockaddr_in server; -int32_t thesock = 0; -u_int32_t address = 0; + int32_t + YSM_RawConnect( int8_t *host, u_int16_t port ) + { + struct sockaddr_in server; + int32_t thesock = 0; + u_int32_t address = 0; /* convert host into an ip address if it isn't already */ if (YSM_HostToAddress(host, &address) < 0) @@ -134,20 +134,20 @@ return -1; return thesock; -} + } /* ProxyHalfConnect: * Takes care of connecting to the proxy server and * returns in order to allow whatever action against * the proxy server is to be taken. * - */ +*/ -int32_t -YSM_ProxyHalfConnect( int8_t *host, u_int16_t port, struct in_addr *outaddress ) -{ -int32_t proxysock = 0; -struct in_addr address; + int32_t + YSM_ProxyHalfConnect( int8_t *host, u_int16_t port, struct in_addr *outaddress ) + { + int32_t proxysock = 0; + struct in_addr address; if (host == NULL) return -1; @@ -182,15 +182,15 @@ return -1; return proxysock; -} + } -int32_t -YSM_ProxyConnect( int8_t *host, u_int16_t port ) -{ -int32_t proxysock = 0; -u_int32_t x = 0; -struct in_addr address; -int8_t proxy_string[512], *aux = NULL, *auxb = NULL; + int32_t + YSM_ProxyConnect( int8_t *host, u_int16_t port ) + { + int32_t proxysock = 0; + u_int32_t x = 0; + struct in_addr address; + int8_t proxy_string[512], *aux = NULL, *auxb = NULL; if (host == NULL) return -1; @@ -310,20 +310,20 @@ /* we return the open socket to the proxy server */ return proxysock; -} + } /* YSM_Connect is the main procedure for connecting to * servers. It makes use of proxy configuration if any * to connect to the proxy servers. - */ +*/ -int32_t -YSM_Connect( int8_t *host, u_int16_t port, int8_t verbose ) -{ -int32_t mysock = 0; -u_int32_t serversize = 0; -struct sockaddr_in server; + int32_t + YSM_Connect( int8_t *host, u_int16_t port, int8_t verbose ) + { + int32_t mysock = 0; + u_int32_t serversize = 0; + struct sockaddr_in server; if (host == NULL || port == 0) return -1; @@ -355,15 +355,15 @@ YSM_USER.d_con.rIP_int = server.sin_addr.s_addr; return mysock; -} + } -void -YSM_SrvResponse( void ) -{ -int8_t *buf = NULL, error_code[2]; -FLAP_Head head; -int32_t r = 0, pos = 0; -TLV login_tlv; + void + YSM_SrvResponse( void ) + { + int8_t *buf = NULL, error_code[2]; + FLAP_Head head; + int32_t r = 0, pos = 0; + TLV login_tlv; memset(&head, 0, sizeof(head)); memset(&error_code, 0, 2); @@ -528,24 +528,24 @@ YSM_Free(buf, __FILE__, __LINE__); buf = NULL; -} + } -static const u_int8_t icqCloneIdent[] = { + static const u_int8_t icqCloneIdent[] = { 0x00,0x01,0x00,0x03,0x00,0x02,0x00,0x01,0x00,0x03,0x00,0x01, 0x00,0x15,0x00,0x01,0x00,0x04,0x00,0x01,0x00,0x06,0x00,0x01, 0x00,0x09,0x00,0x01,0x00,0x0A,0x00,0x01, -}; + }; -static const u_int8_t Rates_Acknowledge[] = { + static const u_int8_t Rates_Acknowledge[] = { 0x00,0x01,0x00,0x02,0x00,0x03,0x00,0x04,0x00,0x05, -}; + }; -int -YSM_Incoming_SNAC( FLAP_Head *head, char *buf, int buflen ) -{ -SNAC_Head thesnac; -int a = 0; + int + YSM_Incoming_SNAC( FLAP_Head *head, char *buf, int buflen ) + { + SNAC_Head thesnac; + int a = 0; /* copy, and beware of padding of structs */ memcpy( &thesnac, buf, SNAC_HEAD_SIZE ); @@ -796,17 +796,17 @@ } return (Chars_2_Wordb(head->dlen) + FLAP_HEAD_SIZE); -} + } -void -YSM_BuddyChangeStatus( FLAP_Head *flap, SNAC_Head *snac, int8_t *data ) -{ -struct YSM_DIRECT_CONNECTION dcinfo; -u_int16_t flags = 0, status = STATUS_OFFLINE; -u_int32_t fprint = 0, uinlen = 0; -time_t onsince = 0; -int8_t *puin = NULL; -YSM_SLAVE *victim = NULL; + void + YSM_BuddyChangeStatus( FLAP_Head *flap, SNAC_Head *snac, int8_t *data ) + { + struct YSM_DIRECT_CONNECTION dcinfo; + u_int16_t flags = 0, status = STATUS_OFFLINE; + u_int32_t fprint = 0, uinlen = 0; + time_t onsince = 0; + int8_t *puin = NULL; + YSM_SLAVE *victim = NULL; if (flap == NULL || snac == NULL || data == NULL || data[0] == '\0') @@ -867,13 +867,13 @@ YSM_Free( puin, __FILE__, __LINE__ ); puin = NULL; -} + } -void -YSM_ParseCapabilities( YSM_SLAVE *victim, int8_t *caps, int32_t len ) -{ -int32_t x, y; -u_int8_t cap_pre[3], capnum[3]; + void + YSM_ParseCapabilities( YSM_SLAVE *victim, int8_t *caps, int32_t len ) + { + int32_t x, y; + u_int8_t cap_pre[3], capnum[3]; if (victim == NULL || caps == NULL || len <= 0) return; @@ -1007,10 +1007,10 @@ PRINTF(VERBOSE_MOREDATA, "Found an ICQ2Go Client\n"); } -} + } -void -YSM_BuddyParseStatus( YSM_SLAVE *victim, /* IN */ + void + YSM_BuddyParseStatus( YSM_SLAVE *victim, /* IN */ FLAP_Head *flap, /* IN */ SNAC_Head *snac, /* IN */ int8_t *data, /* IN */ @@ -1020,11 +1020,11 @@ u_int16_t *status, /* OUT */ u_int16_t *flags, /* OUT */ time_t *onsince ) /* OUT */ -{ -int8_t newstatus[2], newflags[2], notfound = TRUE, *aux = NULL, newfprint[4]; -int8_t rdcCookie[4]; -int32_t x = 0, len = 0; -TLV thetlv; + { + int8_t newstatus[2], newflags[2], notfound = TRUE, *aux = NULL, newfprint[4]; + int8_t rdcCookie[4]; + int32_t x = 0, len = 0; + TLV thetlv; if (victim == NULL || flap == NULL || snac == NULL || data == NULL) return; @@ -1152,19 +1152,19 @@ else *status = Chars_2_Wordb(newstatus); *flags = Chars_2_Wordb(newflags); -} + } -void -YSM_BuddyUpdateStatus( YSM_SLAVE *victim, + void + YSM_BuddyUpdateStatus( YSM_SLAVE *victim, struct YSM_DIRECT_CONNECTION *dcinfo, u_int16_t status, u_int16_t flags, u_int32_t fprint, time_t onsince ) -{ + { -int8_t status_string[MAX_STATUS_LEN], time_string[10]; + int8_t status_string[MAX_STATUS_LEN], time_string[10]; #ifdef COMPACT_DISPLAY int8_t oldstatus_string[MAX_STATUS_LEN]; #endif @@ -1391,17 +1391,17 @@ victim->status = status; g_promptstatus.flags |= FL_REDRAW; -} + } -static void -YSM_TreatMessage( int type, + static void + YSM_TreatMessage( int type, int tsize, char *data, char *uin, char *status, char *msgid ) -{ -YSM_SLAVE *victim = NULL; + { + YSM_SLAVE *victim = NULL; victim = YSM_QuerySlaves(SLAVE_UIN, NULL, atoi(uin), 0); switch(type) @@ -1438,16 +1438,15 @@ type ); break; } -} + } -void -YSM_ReceiveMessage( FLAP_Head *flap, SNAC_Head *snac, char *data ) -{ -char WarnLVL[2], TLVnum[2], r_statusflags[2], r_status[2]; -char MsgID[8], MsgFormat[2], *r_uin; -int tsize = 0, uinsize = 0, len = 0, foundtlv = FALSE; -TLV thetlv; + void YSM_ReceiveMessage( FLAP_Head *flap, SNAC_Head *snac, char *data ) + { + char WarnLVL[2], TLVnum[2], r_statusflags[2], r_status[2]; + char MsgID[8], MsgFormat[2], *r_uin; + int tsize = 0, uinsize = 0, len = 0, foundtlv = FALSE; + TLV thetlv; memcpy( &MsgID, data+tsize, sizeof( MsgID ) ); tsize += sizeof( MsgID ); @@ -1494,8 +1493,7 @@ } - while(!foundtlv - && tsize <= (Chars_2_Wordb( flap->dlen ) - SNAC_HEAD_SIZE)) + while(!foundtlv && tsize <= (Chars_2_Wordb( flap->dlen ) - SNAC_HEAD_SIZE)) { memcpy(&thetlv, data+tsize, sizeof(TLV)); tsize += sizeof(TLV); @@ -1504,14 +1502,19 @@ switch(Chars_2_Wordb(thetlv.type)) { - case 0x03: /* Last TLV found */ + + case 0x03: /* user login timestamp */ tsize += len; - /* seen on trillian, extra TLV here type 4 */ - memcpy( &thetlv, data+tsize, sizeof(TLV)); - if (Chars_2_Wordb(thetlv.type) == 4) - tsize += 4; /* skip next TLV head */ + break; + + case 0x13: /* no idea what this is, just yet */ + tsize += len; + break; + + case 0x02: /* start of Message data */ + YSM_TreatMessage( Chars_2_Wordb(MsgFormat), - tsize, + tsize-sizeof(TLV), /* we want start of TLV */ data, r_uin, r_status, @@ -1531,7 +1534,7 @@ /* possibly strange utility msg. */ case 0x05: YSM_TreatMessage( Chars_2_Wordb(MsgFormat), - tsize, + tsize - sizeof(TLV), /* start at 0x05 */ data, r_uin, r_status, @@ -1547,28 +1550,25 @@ YSM_Free(r_uin, __FILE__, __LINE__); r_uin = NULL; -} + } -void -YSM_ReceiveMessageType1( YSM_SLAVE *victim, + void + YSM_ReceiveMessageType1( YSM_SLAVE *victim, int32_t tsize, u_int8_t *data, int8_t *r_uin, int8_t *r_status, int8_t *m_id ) -{ -int8_t foundtlv = FALSE; -int16_t m_len = 0; -int32_t MsgTLV = 0, len = 0; -u_int32_t fprint = 0x0; -u_int8_t m_flags = 0; -TLV thetlv; + { + int8_t foundtlv = FALSE; + int16_t m_len = 0; + int32_t MsgTLV = 0, len = 0; + u_int32_t fprint = 0x0; + u_int8_t m_flags = 0; + TLV thetlv; if (victim) victim->timing.LastMessage = time(NULL); - /* Quick fingerprint */ - if (data[tsize+5] != 0x01 || data[tsize+6] != 0x01) - fprint = FINGERPRINT_TRILLIAN_CLIENT; memset(&thetlv, '\0', sizeof(TLV)); memcpy(&thetlv, data+tsize, sizeof(TLV)); @@ -1625,15 +1626,15 @@ m_flags, m_len, data+tsize ); -} + } /* This function can be called from DC PEER_MSGs as well as from * ReceiveMessageType2() since the main type2 message body is * the same for both. If dc_flag is TRUE, it was called from DC. - */ +*/ -int32_t -YSM_ReceiveMessageType2Common( YSM_SLAVE *victim, + int32_t + YSM_ReceiveMessageType2Common( YSM_SLAVE *victim, int32_t tsize, u_int8_t *data, int8_t *r_uin, @@ -1642,10 +1643,10 @@ u_int8_t m_flags, u_int16_t *pseq, int8_t dc_flag ) -{ -int8_t m_len[2], m_priority[2], m_type = 0, *pguid = NULL; -int16_t m_status = 0; -int32_t ret = TRUE; + { + int8_t m_len[2], m_priority[2], m_type = 0, *pguid = NULL; + int16_t m_status = 0; + int32_t ret = TRUE; tsize += 2; /* Some Length */ memcpy(pseq, data + tsize, 2); @@ -1705,21 +1706,21 @@ } return ret; -} + } -void -YSM_ReceiveMessageType2( YSM_SLAVE *victim, + void + YSM_ReceiveMessageType2( YSM_SLAVE *victim, int32_t tsize, u_int8_t *data, int8_t *r_uin, int8_t *r_status, int8_t *msgid) -{ -int32_t MsgTLV = 0; -int16_t tmplen = 0, cmd = 0; -int8_t foundtlv = FALSE, msgseq[2], m_type[4]; -u_int8_t m_flags = 0; -TLV thetlv; + { + int32_t MsgTLV = 0; + int16_t tmplen = 0, cmd = 0; + int8_t foundtlv = FALSE, msgseq[2], m_type[4]; + u_int8_t m_flags = 0; + TLV thetlv; if (victim) victim->timing.LastMessage = time(NULL); @@ -1812,16 +1813,16 @@ m_flags, (u_int16_t *)&msgseq, 0x00 ); -} + } -void -YSM_ReceiveMessageType4( YSM_SLAVE *victim, + void + YSM_ReceiveMessageType4( YSM_SLAVE *victim, int32_t tsize, u_int8_t *data, int8_t *r_uin, int8_t *r_status ) -{ -int8_t m_length[2], m_type = 0; + { + int8_t m_length[2], m_type = 0; tsize += 4; /* tlv(5) */ tsize += 4; /* unknown */ @@ -1840,7 +1841,7 @@ 0x00, Chars_2_Word(m_length), data+tsize ); -} + } /* * The return value of this function should tell its caller if its @@ -1849,19 +1850,19 @@ * ret < 0 -> something happened, error type critical (DC handles this) * ret = 1 -> everything went ok, dont send an ACK. * ret > 1 -> everything went ok, send an ACK. - */ +*/ -int32_t -YSM_ReceiveMessageData( YSM_SLAVE *victim, + int32_t + YSM_ReceiveMessageData( YSM_SLAVE *victim, int8_t *r_uin, int16_t r_status, int8_t m_type, u_int8_t m_flags, int16_t m_len, int8_t *m_data ) -{ -int8_t *datap = NULL, *message = NULL, *preason = NULL; -int32_t i = 0, c = 0, ret = 2; + { + int8_t *datap = NULL, *message = NULL, *preason = NULL; + int32_t i = 0, c = 0, ret = 2; /* Are we in Antisocial mode? */ if (victim == NULL @@ -1994,16 +1995,16 @@ } return ret; -} -void -YSM_SendACKType2( int8_t *r_uin, + } + void + YSM_SendACKType2( int8_t *r_uin, int8_t *pseq, int8_t m_type, int8_t *m_id ) -{ -char Format[2], Type[2], reqid[4]; -char *data; -int dlen =0, pos =0; + { + char Format[2], Type[2], reqid[4]; + char *data; + int dlen =0, pos =0; memset(reqid,'\0',4); memset(Type,'\0',2); @@ -2100,11 +2101,11 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -int32_t -YSM_SendSNAC( int Family, + int32_t + YSM_SendSNAC( int Family, int Subtype, int8_t FlA, int8_t FlB, @@ -2112,10 +2113,10 @@ u_int32_t size, int32_t lseq, char *reqid ) -{ -int32_t ReqID; -int nseq = 1,bsize = 0; -char *buf = NULL; + { + int32_t ReqID; + int nseq = 1,bsize = 0; + char *buf = NULL; bsize = SNAC_HEAD_SIZE + FLAP_HEAD_SIZE + size; @@ -2165,21 +2166,21 @@ YSM_Free(buf, __FILE__, __LINE__); buf = NULL; return ReqID; -} + } /* LoginSequence takes care of logging in to the Authentication * server, getting the cookie, and logging in to the BOS server. - */ +*/ -int32_t -YSM_LoginSequence( uin_t uin, int8_t *password ) -{ -u_int32_t datasize = 0, pos = 0; -int32_t r = 0; -int8_t *data = NULL, suin[MAX_UIN_LEN+1], *buf = NULL; -TLV thetlv; -SNAC_Head snac; -FLAP_Head head; + int32_t + YSM_LoginSequence( uin_t uin, int8_t *password ) + { + u_int32_t datasize = 0, pos = 0; + int32_t r = 0; + int8_t *data = NULL, suin[MAX_UIN_LEN+1], *buf = NULL; + TLV thetlv; + SNAC_Head snac; + FLAP_Head head; /* First send a 17,6 SNAC. This way, we request a random * key from the server in order to do an MD5 login. @@ -2257,15 +2258,15 @@ if (snac.ReqID == 0x23) return 1; return 0; -} + } -void -YSM_Init_LoginA( uin_t Uin, u_int8_t *Password ) -{ -FLAP_Head head; -int32_t tsize = 0, ret; -char buf[4]; -char UinStr[MAX_UIN_LEN+1]; + void + YSM_Init_LoginA( uin_t Uin, u_int8_t *Password ) + { + FLAP_Head head; + int32_t tsize = 0, ret; + char buf[4]; + char UinStr[MAX_UIN_LEN+1]; #ifdef WIN32 char PasswdStr[MAX_PWD_LEN+1]; #else @@ -2406,14 +2407,14 @@ /** update the logging in status bar */ PRINTF(VERBOSE_BASE, "**"); -} + } -void -YSM_Init_LoginB( FLAP_Head *head, int8_t *buf, int32_t buflen ) -{ -TLV thetlv; -int32_t len, x = 0; -int8_t *a = NULL, *cookie = NULL; + void + YSM_Init_LoginB( FLAP_Head *head, int8_t *buf, int32_t buflen ) + { + TLV thetlv; + int32_t len, x = 0; + int8_t *a = NULL, *cookie = NULL; if (head == NULL || buf == NULL || buflen <= 0) return; @@ -2498,15 +2499,15 @@ /** update the logging in status bar */ PRINTF(VERBOSE_BASE, "**]"); PRINTF(VERBOSE_BASE,"\n%s\n\n",MSG_LOGIN_OK); -} + } -void -YSM_Init_LoginC( TLV thetlv, char *buff ) -{ -FLAP_Head head; -char buf[4]; -char *paquete = NULL; -int paqsize, newseq, tsize = 0; + void + YSM_Init_LoginC( TLV thetlv, char *buff ) + { + FLAP_Head head; + char buf[4]; + char *paquete = NULL; + int paqsize, newseq, tsize = 0; if (buff == NULL) return; @@ -2572,26 +2573,26 @@ /* update the logging in status bar */ PRINTF(VERBOSE_BASE, "**"); -} + } /* YSM_UpdatePrivacy possible settings are: -0x1 : Allow all users to see you. -0x2 : Block all users from seeing you. (Even the visible) -0x3 : Block all users but the Visible list from seeing you. -0x4 : Block users on your deny list. -0x5 : Only allow users in your buddy list. + 0x1 : Allow all users to see you. + 0x2 : Block all users from seeing you. (Even the visible) + 0x3 : Block all users but the Visible list from seeing you. + 0x4 : Block users on your deny list. + 0x5 : Only allow users in your buddy list. */ -void -YSM_UpdatePrivacy( int Setting ) -{ -int dlen = 0, tsize = 0; -char *data, item_type[2]; -char YSMBuddy_ID[2]; -char reqid[4]; + void + YSM_UpdatePrivacy( int Setting ) + { + int dlen = 0, tsize = 0; + char *data, item_type[2]; + char YSMBuddy_ID[2]; + char reqid[4]; /* We increment the change count on our buddy list for future chgs */ g_sinfo.blentries++; @@ -2643,14 +2644,14 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -int32_t -YSM_ChangeStatus( u_int16_t status ) -{ -TLV thetlv; -u_int32_t len = 0, pos = 0; -int8_t *buf = NULL; + int32_t + YSM_ChangeStatus( u_int16_t status ) + { + TLV thetlv; + u_int32_t len = 0, pos = 0; + int8_t *buf = NULL; /* autoaway is always overriden when calling ChangeStatus. * hence, autoaway MUST be set AFTER the call for away status change. @@ -2767,10 +2768,10 @@ YSM_Free(buf, __FILE__, __LINE__); buf = NULL; return status; -} + } -int32_t -YSM_SendMessage2Client( YSM_SLAVE *victim, + int32_t + YSM_SendMessage2Client( YSM_SLAVE *victim, uin_t r_uin, int16_t m_format, int32_t m_type, @@ -2779,10 +2780,10 @@ u_int8_t m_flags, u_int8_t sendflags, int32_t reqid ) -{ -int8_t *phead = NULL, *pbody = NULL, *pmsg = NULL; -int32_t hsize = 0, bsize = 0; -u_int32_t m_id = 0, m_time = 0; + { + int8_t *phead = NULL, *pbody = NULL, *pmsg = NULL; + int32_t hsize = 0, bsize = 0; + u_int32_t m_id = 0, m_time = 0; m_time = rand() % 0xffff; m_id = rand() % 0xffff; @@ -2875,17 +2876,17 @@ YSM_Free(pbody, __FILE__, __LINE__); pbody = NULL; return 0; -} + } -int32_t -YSM_BuildMessageHead( uin_t r_uin, + int32_t + YSM_BuildMessageHead( uin_t r_uin, int16_t m_format, u_int32_t m_time, u_int32_t m_id, int8_t **phead ) -{ -int16_t pos = 0; -int8_t uinstring[MAX_UIN_LEN]; + { + int16_t pos = 0; + int8_t uinstring[MAX_UIN_LEN]; if (*phead != NULL) return -1; @@ -2916,16 +2917,16 @@ pos += strlen(uinstring); return pos; -} + } -int32_t -YSM_BuildMessageBodyType1( int32_t r_uin, + int32_t + YSM_BuildMessageBodyType1( int32_t r_uin, int8_t *m_data, int32_t m_len, int8_t **pbody ) -{ -int16_t pos = 0; -TLV tlv2, tlv1281, tlv257; + { + int16_t pos = 0; + TLV tlv2, tlv1281, tlv257; if (*pbody != NULL) return -1; @@ -2966,10 +2967,10 @@ pos += m_len; return pos; -} + } -int32_t -YSM_BuildMessageBodyType2( YSM_SLAVE *victim, + int32_t + YSM_BuildMessageBodyType2( YSM_SLAVE *victim, uin_t r_uin, int8_t *m_data, int32_t m_len, @@ -2979,10 +2980,10 @@ u_int8_t m_flags, u_int8_t sendflags, int8_t **pbody ) -{ -int8_t *tlvpack = NULL, m_len2[2]; -u_int32_t tlv5size = 0, bottomsize = 0; -int16_t pos = 0; + { + int8_t *tlvpack = NULL, m_len2[2]; + u_int32_t tlv5size = 0, bottomsize = 0; + int16_t pos = 0; if (*pbody != NULL) return -1; @@ -3163,18 +3164,18 @@ YSM_Free(tlvpack, __FILE__, __LINE__); tlvpack = NULL; return pos; -} + } -int32_t -YSM_BuildMessageBodyType4( uin_t r_uin, + int32_t + YSM_BuildMessageBodyType4( uin_t r_uin, int8_t *m_data, int32_t m_len, int32_t m_type, u_int8_t m_flags, int8_t **pbody ) -{ -int16_t pos = 0; -TLV tlv5; + { + int16_t pos = 0; + TLV tlv5; if (*pbody != NULL) return -1; @@ -3206,12 +3207,12 @@ pos += m_len + 1; return pos; -} + } -void -YSM_ForwardMessage( uin_t r_uin, char *inmsg ) -{ -int8_t outmsg[MAX_DATA_LEN]; + void + YSM_ForwardMessage( uin_t r_uin, char *inmsg ) + { + int8_t outmsg[MAX_DATA_LEN]; memset(outmsg, 0, sizeof(outmsg)); @@ -3219,14 +3220,14 @@ outmsg[sizeof(outmsg)-1] = 0x00; YSM_SendMessage( YSM_SETTING_FORWARD, outmsg, 0, NULL, 1 ); -} + } -void -YSM_SendAuthRequest( uin_t uin, char *Nick, char *Message ) -{ -int8_t *paquete = NULL; -int8_t sUin[MAX_UIN_LEN+1], mlen[2]; -int32_t dlen = 0; + void + YSM_SendAuthRequest( uin_t uin, char *Nick, char *Message ) + { + int8_t *paquete = NULL; + int8_t sUin[MAX_UIN_LEN+1], mlen[2]; + int32_t dlen = 0; memset(sUin, '\0', sizeof(sUin)); snprintf(sUin, MAX_UIN_LEN, "%d", (int)uin); @@ -3266,15 +3267,15 @@ YSM_Free(paquete, __FILE__, __LINE__); paquete = NULL; -} + } -void -YSM_SendAuthOK( uin_t uin, char *Nick ) -{ -int8_t *paquete = NULL; -int8_t ICQStr[MAX_UIN_LEN+1]; -int32_t dlen = 0; + void + YSM_SendAuthOK( uin_t uin, char *Nick ) + { + int8_t *paquete = NULL; + int8_t ICQStr[MAX_UIN_LEN+1]; + int32_t dlen = 0; memset(ICQStr,'\0',sizeof(ICQStr)); snprintf(ICQStr,MAX_UIN_LEN,"%d", (int)uin); @@ -3315,14 +3316,14 @@ YSM_Free(paquete, __FILE__, __LINE__); paquete = NULL; -} + } -void -YSM_SendContacts( void ) -{ -u_int32_t x = 0, usize = 0, ulen = 0; -int8_t *data = NULL, tmp[MAX_UIN_LEN+1]; -YSM_SLAVE *Firstnode = plist_firstSLAVE; + void + YSM_SendContacts( void ) + { + u_int32_t x = 0, usize = 0, ulen = 0; + int8_t *data = NULL, tmp[MAX_UIN_LEN+1]; + YSM_SLAVE *Firstnode = plist_firstSLAVE; for (x = 0; x < List_amountSLAVE; x++) { @@ -3360,13 +3361,13 @@ YSM_SendSNAC(0x3, 0x04, 0x0, 0x0, data, usize, g_sinfo.seqnum++, NULL); YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -void -YSM_RemoveContact( YSM_SLAVE *contact ) -{ -int8_t tmp[MAX_UIN_LEN + 1], *data = NULL; -u_int32_t dlen = 0, ulen = 0; + void + YSM_RemoveContact( YSM_SLAVE *contact ) + { + int8_t tmp[MAX_UIN_LEN + 1], *data = NULL; + u_int32_t dlen = 0, ulen = 0; if (contact == NULL) return; @@ -3401,15 +3402,15 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -/* If a buddy is stored in the server, change his/her */ -/* type to our Ignore list so they don't fuck with us no M0re y0! */ + /* If a buddy is stored in the server, change his/her */ + /* type to our Ignore list so they don't fuck with us no M0re y0! */ -void -YSM_BuddyIgnore( YSM_SLAVE *buddy, int flag ) -{ + void + YSM_BuddyIgnore( YSM_SLAVE *buddy, int flag ) + { if(flag) /* Add to Ignore list */ { buddy->BudType.IgnoreID = YSM_BuddyAddItem( buddy, @@ -3433,15 +3434,15 @@ } YSM_BuddyRequestFinished(); -} + } -/* If a buddy is stored in the server, change his/her */ -/* type to our block/invisible list so they wont see us */ + /* If a buddy is stored in the server, change his/her */ + /* type to our block/invisible list so they wont see us */ -void -YSM_BuddyInvisible( YSM_SLAVE *buddy, int flag ) -{ + void + YSM_BuddyInvisible( YSM_SLAVE *buddy, int flag ) + { if(flag) /* Add to invisible list */ { @@ -3467,15 +3468,15 @@ } YSM_BuddyRequestFinished(); -} + } -/* If a buddy is stored in the server, change his/her */ -/* type to our Allow/Visible list so they see us when we drink */ -/* the magic potion */ -void -YSM_BuddyVisible( YSM_SLAVE *buddy, int flag ) -{ + /* If a buddy is stored in the server, change his/her */ + /* type to our Allow/Visible list so they see us when we drink */ + /* the magic potion */ + void + YSM_BuddyVisible( YSM_SLAVE *buddy, int flag ) + { if(flag) /* Add to the Visible list */ { buddy->BudType.VisibleID = YSM_BuddyAddItem( buddy, @@ -3501,19 +3502,19 @@ } YSM_BuddyRequestFinished(); -} + } -static void -YSM_BuddyAddSlave( char *nick, + static void + YSM_BuddyAddSlave( char *nick, char *uin, char *budID, char *grpID, char *type, int fl) -{ -uin_t uini; -YSM_SLAVE *new = NULL; + { + uin_t uini; + YSM_SLAVE *new = NULL; uini = atoi(uin); if(uini <= 0) return; @@ -3540,15 +3541,15 @@ PRINTF(VERBOSE_SDOWNLOAD,"\n[4]-- done."); } -} + } /* BuddyDelSlave - removes a slave from the server-side contact list. - */ +*/ -void -YSM_BuddyDelSlave( YSM_SLAVE *contact ) -{ + void + YSM_BuddyDelSlave( YSM_SLAVE *contact ) + { if (contact == NULL) return; @@ -3567,12 +3568,12 @@ 0, /* cmd */ 0, /* auth */ 0x0a); /* remove! */ -} + } -void -YSM_BuddyRequestModify( void ) -{ -char reqid[4]; + void + YSM_BuddyRequestModify( void ) + { + char reqid[4]; memset(reqid,0,4); reqid[3] = 0x11; @@ -3584,12 +3585,12 @@ NULL, 0, g_sinfo.seqnum++, reqid); -} + } -void -YSM_BuddyRequestFinished( void ) -{ -char reqid[4]; + void + YSM_BuddyRequestFinished( void ) + { + char reqid[4]; memset(reqid,0,4); reqid[3] = 0x12; @@ -3603,11 +3604,11 @@ 0, g_sinfo.seqnum++, reqid); -} + } -void -YSM_BuddyAck( FLAP_Head *head, SNAC_Head thesnac, char *buf ) -{ + void + YSM_BuddyAck( FLAP_Head *head, SNAC_Head thesnac, char *buf ) + { YSM_SendSNAC( 0x13, 0x07, 0x0, @@ -3615,20 +3616,20 @@ NULL, 0, g_sinfo.seqnum++, NULL); -} + } -/* This function goes through the list of slaves that have */ -/* the downloaded flag on, searching for the biggest budID */ -/* once it finds it, it increments the id by 1 and returns */ + /* This function goes through the list of slaves that have */ + /* the downloaded flag on, searching for the biggest budID */ + /* once it finds it, it increments the id by 1 and returns */ -static int -YSM_BuddyGenNewID( void ) -{ + static int + YSM_BuddyGenNewID( void ) + { -unsigned int x; -int newid = 0; -YSM_SLAVE *rotating = plist_firstSLAVE; + unsigned int x; + int newid = 0; + YSM_SLAVE *rotating = plist_firstSLAVE; for ( x = 0; x < List_amountSLAVE; x++ ) { @@ -3644,10 +3645,10 @@ newid++; return newid; -} + } /* - hehe nice function huh :) well use is this way: +hehe nice function huh :) well use is this way: For adding a Group: Item = 0x0, grpName = groupname @@ -3667,10 +3668,10 @@ * if add_update == 0x0a then REMOVE * * bID holds a buddy ID. if bID == 0, GENERATE ID - */ +*/ -int32_t -YSM_BuddyAddItem( YSM_SLAVE *item, + int32_t + YSM_BuddyAddItem( YSM_SLAVE *item, int8_t *grpname, u_int32_t grpid, u_int32_t bID, @@ -3678,14 +3679,14 @@ u_int32_t cmd, u_int32_t authawait, u_int32_t add_update) -{ -u_int32_t dlen = 0, tsize = 0; -int8_t *data = NULL, *data2 = NULL; -int8_t grp_len[2], item_type[2], YSMBuddyGroup_ID[2]; -int8_t YSMBuddy_ID[2], sUIN[MAX_UIN_LEN+1]; -int8_t **data_list = NULL, *data_list_tmp = NULL, *name = NULL; -int32_t *data_list_amount = NULL, budID = 0; -int8_t reqid[4]; + { + u_int32_t dlen = 0, tsize = 0; + int8_t *data = NULL, *data2 = NULL; + int8_t grp_len[2], item_type[2], YSMBuddyGroup_ID[2]; + int8_t YSMBuddy_ID[2], sUIN[MAX_UIN_LEN+1]; + int8_t **data_list = NULL, *data_list_tmp = NULL, *name = NULL; + int32_t *data_list_amount = NULL, budID = 0; + int8_t reqid[4]; if (item == NULL || grpname == NULL) return -1; @@ -3997,12 +3998,12 @@ return budID; -} + } -static void -YSM_BuddyCreateGroup( void ) -{ + static void + YSM_BuddyCreateGroup( void ) + { /* We initialized the Amount variable to -1, if the group existed while we read the Buddy List but it was empty, we sat 0x0 as its value. (which means no need to create) */ @@ -4022,14 +4023,14 @@ g_sinfo.blusersidentries = 0; } -} + } -void -YSM_BuddyUploadList( YSM_SLAVE *refugee ) -{ -YSM_SLAVE *SlavesList = plist_firstSLAVE; -int i=0, count=0; + void + YSM_BuddyUploadList( YSM_SLAVE *refugee ) + { + YSM_SLAVE *SlavesList = plist_firstSLAVE; + int i=0, count=0; YSM_BuddyCreateGroup(); @@ -4084,12 +4085,12 @@ PRINTF(VERBOSE_BASE, "-- " BLUE "done with ALL SLAVES" NORMAL ".\n" "Use the 'req' command for those who require auth.\n"); -} + } -int -YSM_BuddyReadSlave( char *buf, int tsize ) -{ + int + YSM_BuddyReadSlave( char *buf, int tsize ) + { int size=0,ulen=0,nlen=0; char *uin=0,*nick=0,Nlen[2],xtralen[2],xtratlvtype[2]; char budID[2], grpID[2], budtype[2]; @@ -4173,7 +4174,7 @@ } -/* debugging info */ + /* debugging info */ PRINTF(VERBOSE_SDOWNLOAD,"\nADDING %s with %s\n",nick,uin); /* Last param , 1 == ONLINE slave (Stored on the srv) */ @@ -4185,15 +4186,15 @@ nick = NULL; return size; -} + } -void -YSM_BuddyIncomingChange( FLAP_Head *head, SNAC_Head thesnac, char *buf ) -{ + void + YSM_BuddyIncomingChange( FLAP_Head *head, SNAC_Head thesnac, char *buf ) + { -YSM_SLAVE *SlavesList = plist_firstSLAVE; -char incomingreq[2]; -int i=0; + YSM_SLAVE *SlavesList = plist_firstSLAVE; + char incomingreq[2]; + int i=0; if (plist_firstSLAVE == NULL) return; @@ -4326,18 +4327,18 @@ SlavesList = SlavesList->next; } -} + } -void -YSM_BuddyIncomingList( FLAP_Head *head, + void + YSM_BuddyIncomingList( FLAP_Head *head, SNAC_Head thesnac, char *buf, int buf_len ) -{ -int8_t groupid[2], grouptype[2], d_len[2], g_id[2], chgcount[2]; -int32_t tsize = 0, len = 0, len2 = 0, GrpSlaves = 0, y = 0; -int32_t r = 0, maxdlen = 0, g_amount = 0; -TLV thetlv; + { + int8_t groupid[2], grouptype[2], d_len[2], g_id[2], chgcount[2]; + int32_t tsize = 0, len = 0, len2 = 0, GrpSlaves = 0, y = 0; + int32_t r = 0, maxdlen = 0, g_amount = 0; + TLV thetlv; memset(&thetlv,'\0',sizeof(TLV)); tsize++; /* SSI protocol version (!?) */ @@ -4359,12 +4360,12 @@ tsize += 6; -/* there is this first TLV(1) which we DONT want, so we will just */ -/* skip its header and jump to its data where the tlv (c8) is (only one), */ -/* then we read the len of the c8 tlv and begin from there. */ + /* there is this first TLV(1) which we DONT want, so we will just */ + /* skip its header and jump to its data where the tlv (c8) is (only one), */ + /* then we read the len of the c8 tlv and begin from there. */ -/* we still store its length in case theres a new TLV in it we dont know */ -/* but we still have to skip its content */ + /* we still store its length in case theres a new TLV in it we dont know */ + /* but we still have to skip its content */ memcpy(&thetlv,buf+tsize,sizeof(TLV)); len2 = Chars_2_Wordb(thetlv.len); tsize += sizeof(TLV); @@ -4560,7 +4561,7 @@ } -/* Print some shocking message :) New slaves are always welcome. */ + /* Print some shocking message :) New slaves are always welcome. */ #ifndef COMPACT_DISPLAY PRINTF(VERBOSE_BASE, "\nd[O_o]b %d %s\n",g_amount,MSG_DOWNLOADED_SLAVES); @@ -4575,19 +4576,19 @@ g_promptstatus.flags |= FL_REDRAW; YSM_BuddyAck( head, thesnac, buf ); -} + } -void -YSM_IncomingMultiUse( FLAP_Head *head, SNAC_Head *thesnac, char *buf ) -{ -int32_t tsize = 0; -uin_t uin = 0; -int8_t BytesRem[2], Type[2], ReqID[2], SubID[2], result; -int8_t m_flags, r_uin[MAX_UIN_LEN+1], m_type = 0; -int8_t o_month = 0, o_day = 0, o_hour = 0, o_minutes = 0; -u_int8_t m_len[2]; -YSM_SLAVE *victim = NULL; + void + YSM_IncomingMultiUse( FLAP_Head *head, SNAC_Head *thesnac, char *buf ) + { + int32_t tsize = 0; + uin_t uin = 0; + int8_t BytesRem[2], Type[2], ReqID[2], SubID[2], result; + int8_t m_flags, r_uin[MAX_UIN_LEN+1], m_type = 0; + int8_t o_month = 0, o_day = 0, o_hour = 0, o_minutes = 0; + u_int8_t m_len[2]; + YSM_SLAVE *victim = NULL; /* its a TLV(1) at the very beggining, always. */ tsize += 4; @@ -4726,14 +4727,14 @@ } g_promptstatus.flags |= FL_REDRAW; -} + } -void -YSM_IncomingSearch( char *buf, int tsize ) -{ -char Len[2], *data = NULL; -int len2 = 0; -uin_t ruin = 0; + void + YSM_IncomingSearch( char *buf, int tsize ) + { + char Len[2], *data = NULL; + int len2 = 0; + uin_t ruin = 0; tsize+=2; /* record LEN */ memcpy(&ruin,buf+tsize,4); @@ -4752,14 +4753,14 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -void -YSM_IncomingPersonal( FLAP_Head *head, SNAC_Head *thesnac, int8_t *buf ) -{ -int32_t x = 0, len = 0; -int8_t *aux = NULL; + void + YSM_IncomingPersonal( FLAP_Head *head, SNAC_Head *thesnac, int8_t *buf ) + { + int32_t x = 0, len = 0; + int8_t *aux = NULL; /* uin len */ len = buf[0]; @@ -4805,15 +4806,15 @@ YSM_USER.delta = YSM_USER.timing.Signon - time(NULL); if (YSM_USER.delta < 0) YSM_USER.delta = 0; -} + } -void -YSM_IncomingInfo( char type, char *buf, int tsize, unsigned int reqid ) -{ + void + YSM_IncomingInfo( char type, char *buf, int tsize, unsigned int reqid ) + { -YSM_SLAVE *YSM_Query; -char *pnick = NULL, *pfirst = NULL, *plast = NULL, *pemail = NULL; -uin_t *puin = NULL; + YSM_SLAVE *YSM_Query; + char *pnick = NULL, *pfirst = NULL, *plast = NULL, *pemail = NULL; + uin_t *puin = NULL; /* Incoming is for ourselves? */ if (reqid == (YSM_USER.Uin & 0xffffff7f)) { @@ -4876,10 +4877,10 @@ } -} + } -void -YSM_IncomingMainInfo( int8_t *buf, + void + YSM_IncomingMainInfo( int8_t *buf, int32_t tsize, int8_t *pnick, int8_t *pfirst, @@ -4887,9 +4888,9 @@ int8_t *pemail, u_int32_t reqid, uin_t *puin ) -{ -int8_t *data = NULL, local = 0; -int32_t nlen = 0; + { + int8_t *data = NULL, local = 0; + int32_t nlen = 0; if (buf == NULL) return; @@ -5086,11 +5087,11 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -void -YSM_IncomingHPInfo( int8_t *buf, int32_t tsize ) -{ + void + YSM_IncomingHPInfo( int8_t *buf, int32_t tsize ) + { if (buf == NULL) return; @@ -5107,13 +5108,13 @@ (buf[tsize+2] == 0x02) ? "Male." : "Female." ); } -} + } -void -YSM_IncomingWorkInfo( int8_t *buf, int32_t tsize ) -{ -int8_t *data = NULL; -int32_t nlen = 0; + void + YSM_IncomingWorkInfo( int8_t *buf, int32_t tsize ) + { + int8_t *data = NULL; + int32_t nlen = 0; if (buf == NULL) return; @@ -5149,13 +5150,13 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -void -YSM_IncomingAboutInfo( int8_t *buf, int32_t tsize ) -{ -int8_t *data = NULL; -int16_t len = 0; + void + YSM_IncomingAboutInfo( int8_t *buf, int32_t tsize ) + { + int8_t *data = NULL; + int16_t len = 0; if (buf == NULL) return; @@ -5174,22 +5175,22 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; g_promptstatus.flags |= FL_REDRAW; -} + } -static const u_int8_t icq2000vstring[] = -{ + static const u_int8_t icq2000vstring[] = + { 0x00,0x01,0x00,0x03,0x01,0x10,0x02,0x8A,0x00,0x02,0x00, 0x01,0x01,0x01,0x02,0x8A,0x00,0x03,0x00,0x01,0x01,0x10, 0x02,0x8A,0x00,0x15,0x00,0x01,0x01,0x10,0x02,0x8A,0x00, 0x04,0x00,0x01,0x01,0x10,0x02,0x8A,0x00,0x06,0x00,0x01, 0x01,0x10,0x02,0x8A,0x00,0x09,0x00,0x01,0x01,0x10,0x02, 0x8A,0x00,0x0A,0x00,0x01,0x01,0x10,0x02,0x8A, -}; + }; -static const u_int8_t icq2003avstring[] = -{ + static const u_int8_t icq2003avstring[] = + { 0x00,0x01,0x00,0x03,0x01,0x10,0x04,0x7c, 0x00,0x13,0x00,0x02,0x01,0x10,0x04,0x7c, 0x00,0x02,0x00,0x01,0x01,0x01,0x04,0x7c, @@ -5200,11 +5201,11 @@ 0x00,0x09,0x00,0x01,0x01,0x10,0x04,0x7c, 0x00,0x0A,0x00,0x01,0x01,0x10,0x04,0x7c, 0x00,0x0B,0x00,0x01,0x01,0x10,0x04,0x7c, -}; + }; -void -YSM_SendCliReady( void ) -{ + void + YSM_SendCliReady( void ) + { YSM_SendSNAC( 0x1, 0x2, @@ -5214,20 +5215,20 @@ sizeof(icq2000vstring), g_sinfo.seqnum++, NULL); -} + } -static const u_int8_t icqICBM[] = -{ + static const u_int8_t icqICBM[] = + { 0x00,0x00,0x00,0x00,0x00,0x03,0x1F,0x40,0x03,0xE7,0x03,0xE7, 0x00,0x00,0x00,0x00, -}; + }; -void -YSM_SendICBM( void ) -{ -char *data; -int data_len = 0; + void + YSM_SendICBM( void ) + { + char *data; + int data_len = 0; data_len = sizeof(icqICBM); @@ -5246,24 +5247,24 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -static const u_int8_t icqCapabilities[] = -{ + static const u_int8_t icqCapabilities[] = + { CAP_PRECAP CAP_SRVRELAY CAP_POSCAP CAP_PRECAP CAP_ISICQ CAP_POSCAP #ifdef YSM_USE_CHARCONV CAP_PRECAP CAP_UTF8 CAP_POSCAP #endif -}; + }; -void -YSM_SendCapabilities( void ) -{ -char *data, *data2; -int data_len = 0; + void + YSM_SendCapabilities( void ) + { + char *data, *data2; + int data_len = 0; data_len = sizeof(icqCapabilities) - 1; /* ending zero */ @@ -5288,14 +5289,14 @@ data = NULL; YSM_Free(data2, __FILE__, __LINE__); data2 = NULL; -} + } -int32_t -YSM_RequestInfo( uin_t r_uin, int16_t subtype ) -{ -int8_t rembytes[2], type[2], reqid[2], subt[2], *data = NULL, *data2 = NULL; -int32_t dlen = 0; + int32_t + YSM_RequestInfo( uin_t r_uin, int16_t subtype ) + { + int8_t rembytes[2], type[2], reqid[2], subt[2], *data = NULL, *data2 = NULL; + int32_t dlen = 0; memset(rembytes, '\0', 2); memset(type, '\0', 2); @@ -5334,14 +5335,14 @@ YSM_Free(data2, __FILE__, __LINE__); data2 = NULL; return r_uin; -} + } -void -YSM_RequestOffline( void ) -{ -char BytesRem[2],Type[2],ReqID[2]; -char *data,*data2; -int dlen =0; + void + YSM_RequestOffline( void ) + { + char BytesRem[2],Type[2],ReqID[2]; + char *data,*data2; + int dlen =0; memset(BytesRem,'\0',2); memset(Type,'\0',2); @@ -5378,14 +5379,14 @@ YSM_Free(data2, __FILE__, __LINE__); data2 = NULL; -} + } -void -YSM_AckOffline( void ) -{ -char BytesRem[2],Type[2],ReqID[2]; -char *data,*data2; -int dlen =0; + void + YSM_AckOffline( void ) + { + char BytesRem[2],Type[2],ReqID[2]; + char *data,*data2; + int dlen =0; memset(BytesRem,'\0',2); memset(Type,'\0',2); @@ -5421,11 +5422,11 @@ YSM_Free(data2, __FILE__, __LINE__); data2 = NULL; -} + } -void -YSM_RequestICBMRights( void ) -{ + void + YSM_RequestICBMRights( void ) + { YSM_SendSNAC( 0x04, 0x04, 0x0, @@ -5434,11 +5435,11 @@ 0, g_sinfo.seqnum++, NULL); -} + } -void -YSM_RequestBuddyRights( void ) -{ + void + YSM_RequestBuddyRights( void ) + { YSM_SendSNAC( 0x03, 0x02, 0x0, @@ -5447,14 +5448,14 @@ 0, g_sinfo.seqnum++, NULL); -} + } -void -YSM_RequestContacts( void ) -{ -int dlen,last_time=0; -char *data,records_num[2]; + void + YSM_RequestContacts( void ) + { + int dlen,last_time=0; + char *data,records_num[2]; dlen = sizeof(last_time) + sizeof(records_num); data = YSM_Calloc(1, dlen, __FILE__, __LINE__); @@ -5474,12 +5475,12 @@ YSM_Free(data, __FILE__, __LINE__); data = NULL; -} + } -void -YSM_RequestPersonal( void ) -{ -char reqid[4]; + void + YSM_RequestPersonal( void ) + { + char reqid[4]; memset(reqid, 0, 4); reqid[3] = 0x0E; @@ -5494,11 +5495,11 @@ /* Not only send the damn 01 0E snac, get our info too! */ YSM_RequestInfo(YSM_USER.Uin, (short)0xD004); -} + } -void -YSM_RequestRates( void ) -{ + void + YSM_RequestRates( void ) + { YSM_SendSNAC( 0x01, 0x06, 0x0, @@ -5506,14 +5507,14 @@ NULL, 0, g_sinfo.seqnum++, NULL); -} + } -void -YSM_RequestAutoMessage( YSM_SLAVE *victim ) -{ -int8_t mtype = 0; -int8_t data[2]; + void + YSM_RequestAutoMessage( YSM_SLAVE *victim ) + { + int8_t mtype = 0; + int8_t data[2]; if (victim == NULL) return; @@ -5549,16 +5550,16 @@ 0x03, MFLAGTYPE_NORM, rand() & 0xffffff7f ); -} + } -void -YSM_SearchUINbyMail( char *ContactMail ) -{ -char BytesRem[2],Type[2],ReqID[2],SubTypeID[2]; -char ExtraBytes[2]; -char Mail_lena[2],Mail_lenb[2]; -char *data,*data2; -int dlen =0; + void + YSM_SearchUINbyMail( char *ContactMail ) + { + char BytesRem[2],Type[2],ReqID[2],SubTypeID[2]; + char ExtraBytes[2]; + char Mail_lena[2],Mail_lenb[2]; + char *data,*data2; + int dlen =0; memset(BytesRem,'\0',2); memset(ExtraBytes,'\0',2); @@ -5609,16 +5610,16 @@ YSM_Free(data2, __FILE__, __LINE__); data2 = NULL; -} + } -void -YSM_InfoChange( int desired, char *newsetting ) -{ -char BytesRem[2],Type[2],ReqID[2],SubTypeID[2]; -char nick_len[2], First_len[2], Last_len[2], Mail_len[2]; -char *data,*data2,*nick, Publish_Mail = 0x1; -int dlen =0, tsize=0; + void + YSM_InfoChange( int desired, char *newsetting ) + { + char BytesRem[2],Type[2],ReqID[2],SubTypeID[2]; + char nick_len[2], First_len[2], Last_len[2], Mail_len[2]; + char *data,*data2,*nick, Publish_Mail = 0x1; + int dlen =0, tsize=0; memset(BytesRem,'\0',2); memset(Type,'\0',2); @@ -5764,13 +5765,13 @@ YSM_Free(data2, __FILE__, __LINE__); data2 = NULL; -} + } -void -YSM_ChangePassword( char *newp ) -{ -char *data, *data2, BytesRem[2],Type[2],SubTypeID[2], newp_len[2]; -int dlen = 0, tsize = 0; + void + YSM_ChangePassword( char *newp ) + { + char *data, *data2, BytesRem[2],Type[2],SubTypeID[2], newp_len[2]; + int dlen = 0, tsize = 0; memset(BytesRem,'\0',2); memset(Type,'\0',2); @@ -5822,15 +5823,15 @@ data2 = NULL; -} + } -void -YSM_KeepAlive( void ) -{ + void + YSM_KeepAlive( void ) + { -time_t rightnow = time(NULL); -char *data, *data2, BytesRem[2], Type[2], ReqID[2], SubTypeID[2] ; -int dlen = 0; + time_t rightnow = time(NULL); + char *data, *data2, BytesRem[2], Type[2], ReqID[2], SubTypeID[2] ; + int dlen = 0; if ( (rightnow - YSM_LastKA) > 58 ) { @@ -5874,23 +5875,23 @@ data2 = NULL; } -} + } /* Attention, datalist must be in the following format: * * UIN (ascii) 0xFE NICK (ascii) 0xFE * and so on for each contact you want to send * and amount is in string, examples are : '1', "20", etc :) - */ +*/ -void -YSM_SendContact( YSM_SLAVE *victim, + void + YSM_SendContact( YSM_SLAVE *victim, char *datalist, char *am ) -{ + { -char *smashed_slices_of_rotten_meat; -int buf_len = 0, tsize = 0; + char *smashed_slices_of_rotten_meat; + int buf_len = 0, tsize = 0; buf_len = strlen(am) + 1 + strlen(datalist); @@ -5927,15 +5928,15 @@ YSM_Free(smashed_slices_of_rotten_meat, __FILE__, __LINE__); smashed_slices_of_rotten_meat = NULL; -} + } -void -YSM_SendUrl( YSM_SLAVE *victim, int8_t *url, int8_t *desc ) -{ + void + YSM_SendUrl( YSM_SLAVE *victim, int8_t *url, int8_t *desc ) + { -int8_t *data = NULL; -int32_t size = 0; + int8_t *data = NULL; + int32_t size = 0; size = strlen(url) + strlen(desc) + 3; data = YSM_Calloc( 1, size, __FILE__, __LINE__ ); @@ -5972,19 +5973,19 @@ YSM_Free( data , __FILE__, __LINE__ ); data = NULL; -} + } -void -YSM_SendRTF( YSM_SLAVE *victim ) -{ -int8_t rtfmessage[] = + void + YSM_SendRTF( YSM_SLAVE *victim ) + { + int8_t rtfmessage[] = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0" "\\fnil\\fcharset0 Times New Roman;}}\r\n" "{\\colortbl ;\\red0\\green0\\blue0;}\r\n" "\\viewkind4\\uc1\\pard\\cf1\\f0\\fs20<##icqimage0001> \\par\r\n" "}\r\n"; -u_int8_t flags = 0; + u_int8_t flags = 0; flags |= MFLAGTYPE_NORM; flags |= MFLAGTYPE_RTF; @@ -5998,16 +5999,16 @@ 0x00, flags, 0x06000c00 ); -} + } -void -YSM_Incoming_ClientAck( FLAP_Head *flap, SNAC_Head *snac, int8_t *buf ) -{ -int8_t *autotext = NULL; -u_int8_t *mType = NULL; -u_int32_t pos = 0, ulen = 0; -u_int16_t txtlen = 0; + void + YSM_Incoming_ClientAck( FLAP_Head *flap, SNAC_Head *snac, int8_t *buf ) + { + int8_t *autotext = NULL; + u_int8_t *mType = NULL; + u_int32_t pos = 0, ulen = 0; + u_int16_t txtlen = 0; if (buf == NULL) return; pos += 8; @@ -6073,17 +6074,17 @@ YSM_Free(autotext, __FILE__, __LINE__); autotext = NULL; } -} + } -/* Can either be call from 4,1 or 4,c, check inside */ + /* Can either be call from 4,1 or 4,c, check inside */ -void -YSM_Incoming_Scan( SNAC_Head *thesnac ) -{ -YSM_SLAVE *SlavesList = plist_firstSLAVE; -int32_t i = 0; -int8_t buf[MAX_TIME_LEN]; + void + YSM_Incoming_Scan( SNAC_Head *thesnac ) + { + YSM_SLAVE *SlavesList = plist_firstSLAVE; + int32_t i = 0; + int8_t buf[MAX_TIME_LEN]; for (i = 1; SlavesList != NULL; i++) { @@ -6121,13 +6122,13 @@ } SlavesList = SlavesList->next; } -} + } -static void -YSM_Scan_Slave( YSM_SLAVE *slave ) -{ -int8_t dead_slave_skull[3]; -int32_t buf_len = 0, tsize = 0, reqid = 0; + static void + YSM_Scan_Slave( YSM_SLAVE *slave ) + { + int8_t dead_slave_skull[3]; + int32_t buf_len = 0, tsize = 0, reqid = 0; buf_len = sizeof(dead_slave_skull); memset(dead_slave_skull, 0, buf_len); @@ -6149,19 +6150,19 @@ reqid ); slave->ReqID = reqid; -} + } /* * Set of Slave Punishment functions. * * Attention * No real slaves were wasted during testings of these functions. * Any simmilarity with reality is just pure coincidence. - **/ +**/ -void -YSM_War_Kill( YSM_SLAVE *victim ) -{ + void + YSM_War_Kill( YSM_SLAVE *victim ) + { #ifdef YSM_WITH_THREADS @@ -6191,16 +6192,16 @@ #else PRINTF(VERBOSE_BASE, MSG_ERR_FEATUREDISABLED "\n"); #endif -} + } -/* Thanks to an anonymous liquidk for the required info =) */ -/* You are credited as a heroe. heh. */ + /* Thanks to an anonymous liquidk for the required info =) */ + /* You are credited as a heroe. heh. */ -void -YSM_War_Scan( YSM_SLAVE *victim ) -{ -YSM_SLAVE *SlavesList = plist_firstSLAVE; -int32_t i = 0, count = 0; + void + YSM_War_Scan( YSM_SLAVE *victim ) + { + YSM_SLAVE *SlavesList = plist_firstSLAVE; + int32_t i = 0, count = 0; PRINTF(VERBOSE_BASE, "Please wait..\n"); if (victim != NULL) { @@ -6251,14 +6252,14 @@ PRINTF( VERBOSE_BASE, "-- " BLUE "done with ALL SLAVES. " "(yo'r welcome)" NORMAL ".\n" ); } -} + } -/* end of Punishment functions */ + /* end of Punishment functions */ -void -DumpFLAP( FLAP_Head *inflap ) -{ + void + DumpFLAP( FLAP_Head *inflap ) + { PRINTF(VERBOSE_PACKET, BRIGHT_BLUE "FLAP Information:" NORMAL "\n"); PRINTF(VERBOSE_PACKET, @@ -6270,11 +6271,11 @@ inflap->channelID, Chars_2_Word(inflap->seq), Chars_2_Wordb(inflap->dlen)); -} + } -void -DumpSNAC( SNAC_Head *insnac ) -{ + void + DumpSNAC( SNAC_Head *insnac ) + { PRINTF(VERBOSE_PACKET, BRIGHT_BLUE "SNAC Information:" NORMAL "\n"); @@ -6294,13 +6295,13 @@ insnac->Flags_b, insnac->ReqID); #endif -} + } -void -DumpPacket( FLAP_Head *flap, int8_t *data ) -{ -SNAC_Head *psnac = NULL; -int32_t pos = 0, x = 0; + void + DumpPacket( FLAP_Head *flap, int8_t *data ) + { + SNAC_Head *psnac = NULL; + int32_t pos = 0, x = 0; if (flap == NULL || data == NULL) return; @@ -6328,11 +6329,11 @@ PRINTF( VERBOSE_PACKET, "\n" ); } -} + } -int -InsertTLV(void *string, int type, void *memplace, int len) -{ + int + InsertTLV(void *string, int type, void *memplace, int len) + { TLV thetlv; Word_2_Charsb(thetlv.type, type); @@ -6342,4 +6343,4 @@ memcpy((char *)memplace + sizeof(thetlv), string, len); return (sizeof(thetlv) + len); -} + }