- Timestamp:
- 2009-12-07T21:54:19Z (15 years ago)
- Branches:
- master
- Children:
- 1c3008a
- Parents:
- aac4017 (diff), 36cf9fd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/conference.c
raac4017 r2288705 26 26 static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); 27 27 28 struct groupchat *jabber_chat_join( struct im_connection *ic, c har *room, char *nick,char *password )28 struct groupchat *jabber_chat_join( struct im_connection *ic, const char *room, const char *nick, const char *password ) 29 29 { 30 30 struct jabber_chat *jc; … … 36 36 node = xt_new_node( "x", NULL, NULL ); 37 37 xt_add_attr( node, "xmlns", XMLNS_MUC ); 38 node = jabber_make_packet( "presence", NULL, roomjid, node );39 38 if( password ) 40 39 xt_add_child( node, xt_new_node( "password", password, NULL ) ); 40 node = jabber_make_packet( "presence", NULL, roomjid, node ); 41 41 jabber_cache_add( ic, node, jabber_chat_join_failed ); 42 42 … … 234 234 ( strcmp( s, XMLNS_MUC_USER ) == 0 ) ) 235 235 { 236 c = xt_find_node( c->children, "item" ); 237 if( ( s = xt_find_attr( c, "jid" ) ) ) 236 struct xt_node *item; 237 238 item = xt_find_node( c->children, "item" ); 239 if( ( s = xt_find_attr( item, "jid" ) ) ) 238 240 { 239 241 /* Yay, found what we need. :-) */ … … 283 285 else if( type ) /* type can only be NULL or "unavailable" in this function */ 284 286 { 285 s = strchr( bud->ext_jid, '/' ); 286 if( s ) *s = 0; 287 imcb_chat_remove_buddy( chat, bud->ext_jid, NULL ); 288 if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS ) 289 imcb_remove_buddy( ic, bud->ext_jid, NULL ); 290 if( s ) *s = '/'; 287 if( ( bud->flags & JBFLAG_IS_CHATROOM ) && bud->ext_jid ) 288 { 289 s = strchr( bud->ext_jid, '/' ); 290 if( s ) *s = 0; 291 imcb_chat_remove_buddy( chat, bud->ext_jid, NULL ); 292 if( bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS ) 293 imcb_remove_buddy( ic, bud->ext_jid, NULL ); 294 if( s ) *s = '/'; 295 } 291 296 292 297 if( bud == jc->me ) -
protocols/jabber/iq.c
raac4017 r2288705 51 51 { 52 52 if( !( ( c = xt_find_node( node->children, "query" ) ) || 53 ( c = xt_find_node( node->children, "ping" ) ) ) || /* O_o WHAT is wrong with just <query/> ????? */53 ( c = xt_find_node( node->children, "ping" ) ) ) || 54 54 !( s = xt_find_attr( c, "xmlns" ) ) ) 55 55 { 56 imcb_log( ic, "Warning: Received incomplete IQ-%s packet", type ); 56 /* Sigh. Who decided to suddenly invent new elements 57 instead of just sticking with <query/>? */ 57 58 return XT_HANDLED; 58 59 } -
protocols/jabber/jabber.c
raac4017 r2288705 70 70 71 71 s = set_add( &acc->set, "server", NULL, set_eval_account, acc ); 72 s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY ;72 s->flags |= ACC_SET_NOSAVE | ACC_SET_OFFLINE_ONLY | SET_NULL_OK; 73 73 74 74 s = set_add( &acc->set, "ssl", "false", set_eval_bool, acc ); … … 439 439 } 440 440 441 static struct groupchat *jabber_chat_join_( struct im_connection *ic, c har *room, char *nick,char *password )441 static struct groupchat *jabber_chat_join_( struct im_connection *ic, const char *room, const char *nick, const char *password ) 442 442 { 443 443 if( strchr( room, '@' ) == NULL ) -
protocols/jabber/jabber.h
raac4017 r2288705 27 27 #include <glib.h> 28 28 29 #include "bitlbee.h" 30 #include "md5.h" 29 31 #include "xmltree.h" 30 #include "bitlbee.h"31 32 32 33 extern GSList *jabber_connections; … … 302 303 303 304 /* conference.c */ 304 struct groupchat *jabber_chat_join( struct im_connection *ic, c har *room, char *nick,char *password );305 struct groupchat *jabber_chat_join( struct im_connection *ic, const char *room, const char *nick, const char *password ); 305 306 struct groupchat *jabber_chat_by_jid( struct im_connection *ic, const char *name ); 306 307 void jabber_chat_free( struct groupchat *c ); -
protocols/jabber/jabber_util.c
raac4017 r2288705 37 37 /* Priority is a signed 8-bit integer, according to RFC 3921. */ 38 38 if( i < -128 || i > 127 ) 39 return NULL;39 return SET_INVALID; 40 40 } 41 41 else 42 return NULL;42 return SET_INVALID; 43 43 44 44 /* Only run this stuff if the account is online ATM, -
protocols/jabber/presence.c
raac4017 r2288705 49 49 if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) ) 50 50 { 51 if( set_getbool( &ic->irc->set, "debug" ) ) 52 imcb_log( ic, "Warning: Could not handle presence information from JID: %s", from ); 51 /* 52 imcb_log( ic, "Warning: Could not handle presence information from JID: %s", from ); 53 */ 53 54 return XT_HANDLED; 54 55 } … … 106 107 if( ( bud = jabber_buddy_by_jid( ic, from, 0 ) ) == NULL ) 107 108 { 108 if( set_getbool( &ic->irc->set, "debug" ) ) 109 imcb_log( ic, "Warning: Received presence information from unknown JID: %s", from ); 109 /* 110 imcb_log( ic, "Warning: Received presence information from unknown JID: %s", from ); 111 */ 110 112 return XT_HANDLED; 111 113 } -
protocols/nogaim.c
raac4017 r2288705 33 33 34 34 #define BITLBEE_CORE 35 #include <ctype.h> 36 35 37 #include "nogaim.h" 36 #include <ctype.h>38 #include "chat.h" 37 39 38 40 static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ); … … 249 251 void imcb_connected( struct im_connection *ic ) 250 252 { 253 irc_t *irc = ic->irc; 254 struct chat *c; 251 255 user_t *u; 252 256 … … 271 275 exponential backoff timer. */ 272 276 ic->acc->auto_reconnect_delay = 0; 277 278 for( c = irc->chatrooms; c; c = c->next ) 279 { 280 if( c->acc != ic->acc ) 281 continue; 282 283 if( set_getbool( &c->set, "auto_join" ) ) 284 chat_join( irc, c, NULL ); 285 } 273 286 } 274 287 … … 309 322 ic->acc->prpl->logout( ic ); 310 323 b_event_remove( ic->inpa ); 324 325 g_free( ic->away ); 326 ic->away = NULL; 311 327 312 328 u = irc->users; … … 492 508 } 493 509 494 /* prpl.c */ 495 496 struct show_got_added_data 510 511 struct imcb_ask_cb_data 497 512 { 498 513 struct im_connection *ic; … … 500 515 }; 501 516 502 void show_got_added_no( void *data ) 503 { 504 g_free( ((struct show_got_added_data*)data)->handle ); 517 static void imcb_ask_auth_cb_no( void *data ) 518 { 519 struct imcb_ask_cb_data *cbd = data; 520 521 cbd->ic->acc->prpl->auth_deny( cbd->ic, cbd->handle ); 522 523 g_free( cbd->handle ); 524 g_free( cbd ); 525 } 526 527 static void imcb_ask_auth_cb_yes( void *data ) 528 { 529 struct imcb_ask_cb_data *cbd = data; 530 531 cbd->ic->acc->prpl->auth_allow( cbd->ic, cbd->handle ); 532 533 g_free( cbd->handle ); 534 g_free( cbd ); 535 } 536 537 void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ) 538 { 539 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 540 char *s, *realname_ = NULL; 541 542 if( realname != NULL ) 543 realname_ = g_strdup_printf( " (%s)", realname ); 544 545 s = g_strdup_printf( "The user %s%s wants to add you to his/her buddy list.", 546 handle, realname_ ?: "" ); 547 548 g_free( realname_ ); 549 550 data->ic = ic; 551 data->handle = g_strdup( handle ); 552 query_add( ic->irc, ic, s, imcb_ask_auth_cb_yes, imcb_ask_auth_cb_no, data ); 553 } 554 555 556 static void imcb_ask_add_cb_no( void *data ) 557 { 558 g_free( ((struct imcb_ask_cb_data*)data)->handle ); 505 559 g_free( data ); 506 560 } 507 561 508 void show_got_added_yes( void *data ) 509 { 510 struct show_got_added_data *sga = data; 511 512 sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); 513 /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ 514 515 return show_got_added_no( data ); 516 } 517 518 void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ) 519 { 520 struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 ); 562 static void imcb_ask_add_cb_yes( void *data ) 563 { 564 struct imcb_ask_cb_data *cbd = data; 565 566 cbd->ic->acc->prpl->add_buddy( cbd->ic, cbd->handle, NULL ); 567 568 return imcb_ask_add_cb_no( data ); 569 } 570 571 void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ) 572 { 573 struct imcb_ask_cb_data *data = g_new0( struct imcb_ask_cb_data, 1 ); 521 574 char *s; 522 575 … … 529 582 data->ic = ic; 530 583 data->handle = g_strdup( handle ); 531 query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );584 query_add( ic->irc, ic, s, imcb_ask_add_cb_yes, imcb_ask_add_cb_no, data ); 532 585 } 533 586 … … 699 752 } 700 753 701 struct groupchat *imcb_chat_new( struct im_connection *ic, c har *handle )754 struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) 702 755 { 703 756 struct groupchat *c; … … 928 981 int st; 929 982 930 if( ( g_strcasecmp( value, "true" ) == 0 ) || ( g_strcasecmp( value, "yes" ) == 0 ) || ( g_strcasecmp( value, "on" ) == 0 ) ) 931 st = 1; 932 else if( ( g_strcasecmp( value, "false" ) == 0 ) || ( g_strcasecmp( value, "no" ) == 0 ) || ( g_strcasecmp( value, "off" ) == 0 ) ) 933 st = 0; 934 else if( sscanf( value, "%d", &st ) != 1 ) 935 return( NULL ); 936 937 st = st != 0; 983 if( !is_bool( value ) ) 984 return SET_INVALID; 985 986 st = bool2int( value ); 938 987 939 988 /* Horror.... */ … … 979 1028 } 980 1029 981 return ( set_eval_bool( set, value ) );1030 return value; 982 1031 } 983 1032 -
protocols/nogaim.h
raac4017 r2288705 39 39 #define _NOGAIM_H 40 40 41 #include <stdint.h> 42 41 43 #include "bitlbee.h" 42 44 #include "account.h" … … 210 212 * not implement this. */ 211 213 struct groupchat * 212 (* chat_join) (struct im_connection *, c har *room, char *nick,char *password);214 (* chat_join) (struct im_connection *, const char *room, const char *nick, const char *password); 213 215 /* Change the topic, if supported. Note that BitlBee expects the IM 214 216 server to confirm the topic change with a regular topic change … … 225 227 * - Most protocols will just want to set this to g_strcasecmp().*/ 226 228 int (* handle_cmp) (const char *who1, const char *who2); 229 230 /* Implement these callbacks if you want to use imcb_ask_auth() */ 231 void (* auth_allow) (struct im_connection *, const char *who); 232 void (* auth_deny) (struct im_connection *, const char *who); 227 233 228 234 /* Incoming transfer request */ … … 243 249 * the account_t parameter. */ 244 250 G_MODULE_EXPORT struct im_connection *imcb_new( account_t *acc ); 245 G_MODULE_EXPORT void imc b_free( struct im_connection *ic );251 G_MODULE_EXPORT void imc_free( struct im_connection *ic ); 246 252 /* Once you're connected, you should call this function, so that the user will 247 253 * see the success. */ … … 256 262 /* To tell the user an error, ie. before logging out when an error occurs. */ 257 263 G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 264 258 265 /* To ask a your about something. 259 266 * - 'msg' is the question. … … 262 269 */ 263 270 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ); 264 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); 271 272 /* Two common questions you may want to ask: 273 * - X added you to his contact list, allow? 274 * - X is not in your contact list, want to add? 275 */ 276 G_MODULE_EXPORT void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname ); 277 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname ); 265 278 266 279 /* Buddy management */ … … 294 307 * the user her/himself. At that point the group chat will be visible to the 295 308 * user, too. */ 296 G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, c har *handle );309 G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ); 297 310 G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, char *handle ); 298 311 /* To remove a handle from a group chat. Reason can be NULL. */ -
protocols/oscar/aim.h
raac4017 r2288705 144 144 } 145 145 146 #define AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 { \ 147 "AOL Instant Messenger, version 5.1.3036/WIN32", \ 148 0x0109, \ 149 0x0005, \ 150 0x0001, \ 151 0x0000, \ 152 0x0bdc, \ 153 "us", \ 154 "en", \ 155 } 156 146 157 /* 147 158 * I would make 4.1.2010 the default, but they seem to have found … … 152 163 * around. (see login.c::memrequest()) 153 164 */ 154 #define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_ 3_5_1670165 #define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 155 166 156 167 #ifndef TRUE -
protocols/oscar/oscar.c
raac4017 r2288705 91 91 GSList *oscar_chats; 92 92 93 gboolean killme ;93 gboolean killme, no_reconnect; 94 94 gboolean icq; 95 95 GSList *evilhack; … … 181 181 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); 182 182 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); 183 static int gaim_parse_logout (aim_session_t *, aim_frame_t *, ...); 183 184 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); 184 185 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); … … 294 295 aim_rxdispatch(odata->sess); 295 296 if (odata->killme) 296 imc_logout(ic, TRUE);297 imc_logout(ic, !odata->no_reconnect); 297 298 } else { 298 299 if ((conn->type == AIM_CONN_TYPE_BOS) || … … 520 521 case 0x18: 521 522 /* connecting too frequently */ 523 od->no_reconnect = TRUE; 522 524 imcb_error(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); 523 525 break; … … 572 574 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parseaiminfo, 0); 573 575 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parsemtn, 0); 576 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_parse_logout, 0); 574 577 575 578 ((struct oscar_data *)ic->proto_data)->conn = bosconn; … … 747 750 748 751 aim_send_login(sess, fr->conn, ic->acc->user, ic->acc->pass, &info, key); 752 753 return 1; 754 } 755 756 static int gaim_parse_logout(aim_session_t *sess, aim_frame_t *fr, ...) { 757 struct im_connection *ic = sess->aux_data; 758 struct oscar_data *odata = ic->proto_data; 759 int code; 760 va_list ap; 761 762 va_start(ap, fr); 763 code = va_arg(ap, int); 764 va_end(ap); 765 766 imcb_error( ic, "Connection aborted by server: %s", code == 1 ? 767 "someone else logged in with your account" : 768 "unknown reason" ); 769 770 /* Tell BitlBee to disable auto_reconnect if code == 1, since that 771 means a concurrent login somewhere else. */ 772 odata->no_reconnect = code == 1; 773 774 /* DO NOT log out here! Just tell the callback to do it. */ 775 odata->killme = TRUE; 749 776 750 777 return 1; … … 1939 1966 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); 1940 1967 1941 if (ic->away) 1942 g_free(ic->away); 1968 g_free(ic->away); 1943 1969 ic->away = NULL; 1944 1970 … … 1960 1986 static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message) 1961 1987 { 1962 1988 const char *msg = NULL; 1963 1989 gboolean no_message = FALSE; 1964 1990 1965 1991 /* clean old states */ 1966 if (ic->away) { 1967 g_free(ic->away); 1968 ic->away = NULL; 1969 } 1992 g_free(ic->away); 1993 ic->away = NULL; 1970 1994 od->sess->aim_icq_state = 0; 1971 1995 1972 1996 /* if no message, then use an empty message */ 1973 1974 1975 1976 1997 if (message) { 1998 msg = message; 1999 } else { 2000 msg = ""; 1977 2001 no_message = TRUE; 1978 2002 } 1979 2003 1980 2004 if (!g_strcasecmp(state, "Online")) { … … 1982 2006 } else if (!g_strcasecmp(state, "Away")) { 1983 2007 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); 1984 2008 ic->away = g_strdup(msg); 1985 2009 od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY; 1986 2010 } else if (!g_strcasecmp(state, "Do Not Disturb")) { 1987 2011 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY); 1988 2012 ic->away = g_strdup(msg); 1989 2013 od->sess->aim_icq_state = AIM_MTYPE_AUTODND; 1990 2014 } else if (!g_strcasecmp(state, "Not Available")) { 1991 2015 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); 1992 2016 ic->away = g_strdup(msg); 1993 2017 od->sess->aim_icq_state = AIM_MTYPE_AUTONA; 1994 2018 } else if (!g_strcasecmp(state, "Occupied")) { 1995 2019 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY); 1996 2020 ic->away = g_strdup(msg); 1997 2021 od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY; 1998 2022 } else if (!g_strcasecmp(state, "Free For Chat")) { 1999 2023 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT); 2000 2024 ic->away = g_strdup(msg); 2001 2025 od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC; 2002 2026 } else if (!g_strcasecmp(state, "Invisible")) { 2003 2027 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); 2004 2028 ic->away = g_strdup(msg); 2005 2029 } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) { 2006 2030 if (no_message) { … … 2008 2032 } else { 2009 2033 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); 2010 2034 ic->away = g_strdup(msg); 2011 2035 od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY; 2012 2036 } … … 2020 2044 struct oscar_data *od = (struct oscar_data *)ic->proto_data; 2021 2045 2022 2046 oscar_set_away_aim(ic, od, state, message); 2023 2047 if (od->icq) 2024 2048 oscar_set_away_icq(ic, od, state, message); … … 2581 2605 } 2582 2606 2583 struct groupchat *oscar_chat_join(struct im_connection * ic, c har * room, char * nick,char * password )2607 struct groupchat *oscar_chat_join(struct im_connection * ic, const char * room, const char * nick, const char * password ) 2584 2608 { 2585 2609 struct oscar_data * od = (struct oscar_data *)ic->proto_data; -
protocols/yahoo/libyahoo2.c
raac4017 r2288705 89 89 90 90 #include "base64.h" 91 #include "http_client.h" 91 92 92 93 #ifdef USE_STRUCT_CALLBACKS … … 169 170 YAHOO_SERVICE_GOTGROUPRENAME, /* < 1, 36(old), 37(new) */ 170 171 YAHOO_SERVICE_SYSMESSAGE = 0x14, 172 YAHOO_SERVICE_SKINNAME = 0x15, 171 173 YAHOO_SERVICE_PASSTHROUGH2 = 0x16, 172 174 YAHOO_SERVICE_CONFINVITE = 0x18, … … 192 194 YAHOO_SERVICE_LIST, 193 195 YAHOO_SERVICE_AUTH = 0x57, 196 YAHOO_SERVICE_AUTHBUDDY = 0x6d, 194 197 YAHOO_SERVICE_ADDBUDDY = 0x83, 195 198 YAHOO_SERVICE_REMBUDDY, … … 197 200 YAHOO_SERVICE_REJECTCONTACT, 198 201 YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */ 202 YAHOO_SERVICE_Y7_PING = 0x8A, /* 0 - id and that's it?? */ 199 203 YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ 200 204 YAHOO_SERVICE_CHATGOTO, … … 202 206 YAHOO_SERVICE_CHATLEAVE, 203 207 YAHOO_SERVICE_CHATEXIT = 0x9b, 208 YAHOO_SERVICE_CHATADDINVITE = 0x9d, 204 209 YAHOO_SERVICE_CHATLOGOUT = 0xa0, 205 210 YAHOO_SERVICE_CHATPING, … … 209 214 YAHOO_SERVICE_PICTURE = 0xbe, 210 215 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, 211 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2 216 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2, 217 YAHOO_SERVICE_Y6_VISIBILITY=0xc5, 218 YAHOO_SERVICE_Y6_STATUS_UPDATE=0xc6, 219 YAHOO_PHOTOSHARE_INIT=0xd2, 220 YAHOO_SERVICE_CONTACT_YMSG13=0xd6, 221 YAHOO_PHOTOSHARE_PREV=0xd7, 222 YAHOO_PHOTOSHARE_KEY=0xd8, 223 YAHOO_PHOTOSHARE_TRANS=0xda, 224 YAHOO_FILE_TRANSFER_INIT_YMSG13=0xdc, 225 YAHOO_FILE_TRANSFER_GET_YMSG13=0xdd, 226 YAHOO_FILE_TRANSFER_PUT_YMSG13=0xde, 227 YAHOO_SERVICE_YMSG15_STATUS=0xf0, 228 YAHOO_SERVICE_YMSG15_BUDDY_LIST=0xf1, 212 229 }; 213 230 … … 733 750 734 751 memcpy(data + pos, "YMSG", 4); pos += 4; 735 pos += yahoo_put16(data + pos, 0x000c);752 pos += yahoo_put16(data + pos, YAHOO_PROTO_VER); 736 753 pos += yahoo_put16(data + pos, 0x0000); 737 754 pos += yahoo_put16(data + pos, pktlen + extra_pad); … … 747 764 yahoo_send_data(yid->fd, data, len); 748 765 else 749 yahoo_add_to_send_queue(yid, data, len);766 yahoo_add_to_send_queue(yid, data, len); 750 767 FREE(data); 751 768 } … … 1467 1484 1468 1485 if (u->name != NULL) { 1469 if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) {1486 if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */ 1470 1487 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1471 1488 } else { 1489 /* Key 47 always seems to be 1 for YMSG16 */ 1490 if(!u->state) 1491 u->away = 0; 1492 else 1493 u->away = 1; 1494 1472 1495 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile); 1473 1496 } … … 1477 1500 y_list_free_1(t); 1478 1501 FREE(u); 1502 } 1503 } 1504 1505 static void yahoo_process_buddy_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 1506 { 1507 struct yahoo_data *yd = yid->yd; 1508 YList *l; 1509 int last_packet = 0; 1510 char *cur_group = NULL; 1511 struct yahoo_buddy *newbud = NULL; 1512 1513 /* we could be getting multiple packets here */ 1514 for (l = pkt->hash; l; l = l->next) { 1515 struct yahoo_pair *pair = l->data; 1516 1517 switch(pair->key) { 1518 case 300: 1519 case 301: 1520 case 302: 1521 case 303: 1522 if ( 315 == atoi(pair->value) ) 1523 last_packet = 1; 1524 break; 1525 case 65: 1526 g_free(cur_group); 1527 cur_group = strdup(pair->value); 1528 break; 1529 case 7: 1530 newbud = y_new0(struct yahoo_buddy, 1); 1531 newbud->id = strdup(pair->value); 1532 if(cur_group) 1533 newbud->group = strdup(cur_group); 1534 else { 1535 struct yahoo_buddy *lastbud = (struct yahoo_buddy *)y_list_nth( 1536 yd->buddies, y_list_length(yd->buddies)-1)->data; 1537 newbud->group = strdup(lastbud->group); 1538 } 1539 1540 yd->buddies = y_list_append(yd->buddies, newbud); 1541 1542 break; 1543 } 1544 } 1545 1546 g_free(cur_group); 1547 1548 /* we could be getting multiple packets here */ 1549 if (last_packet) 1550 return; 1551 1552 YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies); 1553 1554 /*** We login at the very end of the packet communication */ 1555 if (!yd->logged_in) { 1556 yd->logged_in = TRUE; 1557 if(yd->current_status < 0) 1558 yd->current_status = yd->initial_status; 1559 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL); 1479 1560 } 1480 1561 } … … 1549 1630 } 1550 1631 1551 if(yd->cookie_y && yd->cookie_t && yd->cookie_c)1632 if(yd->cookie_y && yd->cookie_t) 1552 1633 YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id); 1553 1634 … … 2226 2307 } 2227 2308 2309 struct yahoo_https_auth_data 2310 { 2311 struct yahoo_input_data *yid; 2312 char *token; 2313 char *chal; 2314 }; 2315 2316 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had); 2317 static void yahoo_https_auth_token_finish(struct http_request *req); 2318 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had); 2319 static void yahoo_https_auth_finish(struct http_request *req); 2320 2321 /* Extract a value from a login.yahoo.com response. Assume CRLF-linebreaks 2322 and FAIL miserably if they're not there... */ 2323 static char *yahoo_ha_find_key(char *response, char *key) 2324 { 2325 char *s, *end; 2326 int len = strlen(key); 2327 2328 s = response; 2329 do { 2330 if (strncmp(s, key, len) == 0 && s[len] == '=') { 2331 s += len + 1; 2332 if ((end = strchr(s, '\r'))) 2333 return g_strndup(s, end - s); 2334 else 2335 return g_strdup(s); 2336 } 2337 2338 if ((s = strchr(s, '\n'))) 2339 s ++; 2340 } while (s && *s); 2341 2342 return NULL; 2343 } 2344 2345 static enum yahoo_status yahoo_https_status_parse(int code) 2346 { 2347 switch (code) 2348 { 2349 case 1212: return YAHOO_LOGIN_PASSWD; 2350 case 1213: return YAHOO_LOGIN_LOCK; 2351 case 1235: return YAHOO_LOGIN_UNAME; 2352 default: return (enum yahoo_status) code; 2353 } 2354 } 2355 2356 static void yahoo_process_auth_0x10(struct yahoo_input_data *yid, const char *seed, const char *sn) 2357 { 2358 struct yahoo_https_auth_data *had = g_new0(struct yahoo_https_auth_data, 1); 2359 2360 had->yid = yid; 2361 had->chal = g_strdup(seed); 2362 2363 yahoo_https_auth_token_init(had); 2364 } 2365 2366 static void yahoo_https_auth_token_init(struct yahoo_https_auth_data *had) 2367 { 2368 struct yahoo_input_data *yid = had->yid; 2369 struct yahoo_data *yd = yid->yd; 2370 struct http_request *req; 2371 char *login, *passwd, *chal; 2372 char *url; 2373 2374 login = g_strndup(yd->user, 3 * strlen(yd->user)); 2375 http_encode(login); 2376 passwd = g_strndup(yd->password, 3 * strlen(yd->password)); 2377 http_encode(passwd); 2378 chal = g_strndup(had->chal, 3 * strlen(had->chal)); 2379 http_encode(chal); 2380 2381 url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=%d&login=%s&passwd=%s&chal=%s", 2382 (int) time(NULL), login, passwd, chal); 2383 2384 req = http_dorequest_url(url, yahoo_https_auth_token_finish, had); 2385 2386 g_free(url); 2387 g_free(chal); 2388 g_free(passwd); 2389 g_free(login); 2390 } 2391 2392 static void yahoo_https_auth_token_finish(struct http_request *req) 2393 { 2394 struct yahoo_https_auth_data *had = req->data; 2395 struct yahoo_input_data *yid = had->yid; 2396 struct yahoo_data *yd = yid->yd; 2397 int st; 2398 2399 if (req->status_code != 200) { 2400 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL); 2401 goto fail; 2402 } 2403 2404 if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) { 2405 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL); 2406 goto fail; 2407 } 2408 2409 if ((had->token = yahoo_ha_find_key(req->reply_body, "ymsgr")) == NULL) { 2410 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3001, NULL); 2411 goto fail; 2412 } 2413 2414 return yahoo_https_auth_init(had); 2415 2416 fail: 2417 g_free(had->token); 2418 g_free(had->chal); 2419 g_free(had); 2420 } 2421 2422 static void yahoo_https_auth_init(struct yahoo_https_auth_data *had) 2423 { 2424 struct http_request *req; 2425 char *url; 2426 2427 url = g_strdup_printf("https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=%d&token=%s", 2428 (int) time(NULL), had->token); 2429 2430 req = http_dorequest_url(url, yahoo_https_auth_finish, had); 2431 2432 g_free(url); 2433 } 2434 2435 static void yahoo_https_auth_finish(struct http_request *req) 2436 { 2437 struct yahoo_https_auth_data *had = req->data; 2438 struct yahoo_input_data *yid = had->yid; 2439 struct yahoo_data *yd = yid->yd; 2440 struct yahoo_packet *pack; 2441 char *crumb; 2442 int st; 2443 2444 md5_byte_t result[16]; 2445 md5_state_t ctx; 2446 2447 unsigned char yhash[32]; 2448 2449 if (req->status_code != 200) { 2450 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 2000 + req->status_code, NULL); 2451 goto fail; 2452 } 2453 2454 if (sscanf(req->reply_body, "%d", &st) != 1 || st != 0) { 2455 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, yahoo_https_status_parse(st), NULL); 2456 goto fail; 2457 } 2458 2459 if ((yd->cookie_y = yahoo_ha_find_key(req->reply_body, "Y")) == NULL || 2460 (yd->cookie_t = yahoo_ha_find_key(req->reply_body, "T")) == NULL || 2461 (crumb = yahoo_ha_find_key(req->reply_body, "crumb")) == NULL) { 2462 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, 3002, NULL); 2463 goto fail; 2464 } 2465 2466 md5_init(&ctx); 2467 md5_append(&ctx, (unsigned char*) crumb, 11); 2468 md5_append(&ctx, (unsigned char*) had->chal, strlen(had->chal)); 2469 md5_finish(&ctx, result); 2470 to_y64(yhash, result, 16); 2471 2472 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->initial_status, yd->session_id); 2473 yahoo_packet_hash(pack, 1, yd->user); 2474 yahoo_packet_hash(pack, 0, yd->user); 2475 yahoo_packet_hash(pack, 277, yd->cookie_y); 2476 yahoo_packet_hash(pack, 278, yd->cookie_t); 2477 yahoo_packet_hash(pack, 307, (char*) yhash); 2478 yahoo_packet_hash(pack, 244, "524223"); 2479 yahoo_packet_hash(pack, 2, yd->user); 2480 yahoo_packet_hash(pack, 2, "1"); 2481 yahoo_packet_hash(pack, 98, "us"); 2482 yahoo_packet_hash(pack, 135, "7.5.0.647"); 2483 2484 yahoo_send_packet(yid, pack, 0); 2485 2486 yahoo_packet_free(pack); 2487 2488 fail: 2489 g_free(crumb); 2490 g_free(had->token); 2491 g_free(had->chal); 2492 g_free(had); 2493 } 2494 2228 2495 static void yahoo_process_auth(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 2229 2496 { … … 2253 2520 case 1: 2254 2521 yahoo_process_auth_0x0b(yid, seed, sn); 2522 break; 2523 case 2: 2524 yahoo_process_auth_0x10(yid, seed, sn); 2255 2525 break; 2256 2526 default: … … 2408 2678 2409 2679 yd->buddies = y_list_append(yd->buddies, bud); 2410 2680 2411 2681 /* Possibly called already, but at least the call above doesn't 2412 2682 seem to happen every time (not anytime I tried). */ … … 2415 2685 2416 2686 /* YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */ 2687 } 2688 2689 static void yahoo_process_contact_ymsg13(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 2690 { 2691 char* who=NULL; 2692 char* me=NULL; 2693 char* msg=NULL; 2694 YList *l; 2695 for (l = pkt->hash; l; l = l->next) { 2696 struct yahoo_pair *pair = l->data; 2697 if (pair->key == 4) 2698 who = pair->value; 2699 else if (pair->key == 5) 2700 me = pair->value; 2701 else 2702 DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value)); 2703 } 2704 2705 if(pkt->status==3) 2706 YAHOO_CALLBACK(ext_yahoo_contact_auth_request)(yid->yd->client_id, me, who, msg); 2417 2707 } 2418 2708 … … 2628 2918 2629 2919 YList *l; 2630 yahoo_dump_unhandled(pkt);2920 // yahoo_dump_unhandled(pkt); 2631 2921 for (l = pkt->hash; l; l = l->next) { 2632 2922 struct yahoo_pair *pair = l->data; … … 2650 2940 { 2651 2941 DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service)); 2942 yahoo_dump_unhandled(pkt); 2652 2943 switch (pkt->service) 2653 2944 { … … 2661 2952 case YAHOO_SERVICE_IDACT: 2662 2953 case YAHOO_SERVICE_IDDEACT: 2954 case YAHOO_SERVICE_Y6_STATUS_UPDATE: 2955 case YAHOO_SERVICE_YMSG15_STATUS: 2663 2956 yahoo_process_status(yid, pkt); 2664 2957 break; … … 2674 2967 yahoo_process_mail(yid, pkt); 2675 2968 break; 2969 case YAHOO_SERVICE_REJECTCONTACT: 2676 2970 case YAHOO_SERVICE_NEWCONTACT: 2677 2971 yahoo_process_contact(yid, pkt); … … 2714 3008 yahoo_process_buddyadd(yid, pkt); 2715 3009 break; 3010 case YAHOO_SERVICE_CONTACT_YMSG13: 3011 yahoo_process_contact_ymsg13(yid,pkt); 3012 break; 2716 3013 case YAHOO_SERVICE_REMBUDDY: 2717 3014 yahoo_process_buddydel(yid, pkt); … … 2742 3039 case YAHOO_SERVICE_CHATLOGOFF: 2743 3040 case YAHOO_SERVICE_CHATMSG: 2744 case YAHOO_SERVICE_REJECTCONTACT:2745 3041 case YAHOO_SERVICE_PEERTOPEER: 2746 3042 WARNING(("unhandled service 0x%02x", pkt->service)); … … 2756 3052 yahoo_process_picture_upload(yid, pkt); 2757 3053 break; 3054 case YAHOO_SERVICE_YMSG15_BUDDY_LIST: /* Buddy List */ 3055 yahoo_process_buddy_list(yid, pkt); 2758 3056 default: 2759 3057 WARNING(("unknown service 0x%02x", pkt->service)); … … 3539 3837 yahoo_process_webcam_connection, 3540 3838 yahoo_process_chatcat_connection, 3541 yahoo_process_search_connection 3839 yahoo_process_search_connection, 3542 3840 }; 3543 3841 … … 3557 3855 } while(len == -1 && errno == EINTR); 3558 3856 3559 if(len == -1 && errno == EAGAIN) /* we'll try again later */3857 if(len == -1 && (errno == EAGAIN||errno == EINTR)) /* we'll try again later */ 3560 3858 return 1; 3561 3859 … … 3760 4058 3761 4059 yahoo_packet_hash(pkt, 5, who); 3762 yahoo_packet_hash(pkt, 4, from?from:yd->user);4060 yahoo_packet_hash(pkt, 1, from?from:yd->user); 3763 4061 yahoo_packet_hash(pkt, 14, " "); 3764 4062 yahoo_packet_hash(pkt, 13, typ ? "1" : "0"); … … 3775 4073 struct yahoo_data *yd; 3776 4074 struct yahoo_packet *pkt = NULL; 3777 int service;4075 int old_status; 3778 4076 char s[4]; 3779 4077 … … 3783 4081 yd = yid->yd; 3784 4082 3785 if (msg) { 4083 old_status = yd->current_status; 4084 4085 if (msg && strncmp(msg,"Invisible",9)) { 3786 4086 yd->current_status = YAHOO_STATUS_CUSTOM; 3787 4087 } else { … … 3789 4089 } 3790 4090 3791 if (yd->current_status == YAHOO_STATUS_AVAILABLE) 3792 service = YAHOO_SERVICE_ISBACK; 3793 else 3794 service = YAHOO_SERVICE_ISAWAY; 4091 /* Thank you libpurple :) */ 4092 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { 4093 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0); 4094 yahoo_packet_hash(pkt, 13, "2"); 4095 yahoo_send_packet(yid, pkt, 0); 4096 yahoo_packet_free(pkt); 4097 4098 return; 4099 } 4100 4101 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, yd->current_status, yd->session_id); 4102 snprintf(s, sizeof(s), "%d", yd->current_status); 4103 yahoo_packet_hash(pkt, 10, s); 3795 4104 3796 if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) { 3797 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id); 3798 yahoo_packet_hash(pkt, 10, "999"); 3799 yahoo_packet_hash(pkt, 47, "2"); 3800 }else { 3801 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, yd->session_id); 3802 snprintf(s, sizeof(s), "%d", yd->current_status); 3803 yahoo_packet_hash(pkt, 10, s); 3804 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 3805 yahoo_packet_hash(pkt, 19, msg); 3806 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3807 } else { 3808 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3809 } 3810 3811 3812 3813 } 4105 if (yd->current_status == YAHOO_STATUS_CUSTOM) { 4106 yahoo_packet_hash(pkt, 19, msg); 4107 } else { 4108 yahoo_packet_hash(pkt, 19, ""); 4109 } 4110 4111 yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0"); 3814 4112 3815 4113 yahoo_send_packet(yid, pkt, 0); 3816 4114 yahoo_packet_free(pkt); 4115 4116 if(old_status == YAHOO_STATUS_INVISIBLE) { 4117 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0); 4118 yahoo_packet_hash(pkt, 13, "1"); 4119 yahoo_send_packet(yid, pkt, 0); 4120 yahoo_packet_free(pkt); 4121 } 3817 4122 } 3818 4123 … … 3829 4134 LOG(("yahoo_logoff: current status: %d", yd->current_status)); 3830 4135 3831 if(yd->current_status != -1) { 4136 if(yd->current_status != -1 && 0) { 4137 /* Meh. Don't send this. The event handlers are not going to 4138 get to do this so it'll just leak memory. And the TCP 4139 connection reset will hopefully be clear enough. */ 3832 4140 pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id); 3833 4141 yd->current_status = -1; … … 4062 4370 return; 4063 4371 4064 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); 4065 yahoo_packet_hash(pkt, 1, yd->user); 4066 yahoo_packet_hash(pkt, 7, who); 4067 yahoo_packet_hash(pkt, 65, group); 4372 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YPACKET_STATUS_DEFAULT, yd->session_id); 4373 4068 4374 if (msg != NULL) /* add message/request "it's me add me" */ 4069 4375 yahoo_packet_hash(pkt, 14, msg); 4376 else 4377 yahoo_packet_hash(pkt,14,""); 4378 4379 yahoo_packet_hash(pkt, 65, group); 4380 yahoo_packet_hash(pkt, 97, "1"); 4381 yahoo_packet_hash(pkt, 1, yd->user); 4382 yahoo_packet_hash(pkt, 302, "319"); 4383 yahoo_packet_hash(pkt, 300, "319"); 4384 yahoo_packet_hash(pkt, 7, who); 4385 yahoo_packet_hash(pkt, 334, "0"); 4386 yahoo_packet_hash(pkt, 301, "319"); 4387 yahoo_packet_hash(pkt, 303, "319"); 4388 4389 4070 4390 yahoo_send_packet(yid, pkt, 0); 4071 4391 yahoo_packet_free(pkt); … … 4089 4409 yahoo_send_packet(yid, pkt, 0); 4090 4410 yahoo_packet_free(pkt); 4411 } 4412 4413 void yahoo_accept_buddy_ymsg13(int id,const char* me,const char* who){ 4414 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4415 struct yahoo_data *yd; 4416 4417 if(!yid) 4418 return; 4419 yd = yid->yd; 4420 4421 struct yahoo_packet* pkt=NULL; 4422 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); 4423 4424 yahoo_packet_hash(pkt,1,me ?: yd->user); 4425 yahoo_packet_hash(pkt,5,who); 4426 yahoo_packet_hash(pkt,13,"1"); 4427 yahoo_packet_hash(pkt,334,"0"); 4428 yahoo_send_packet(yid, pkt, 0); 4429 yahoo_packet_free(pkt); 4430 } 4431 4432 void yahoo_reject_buddy_ymsg13(int id,const char* me,const char* who,const char* msg){ 4433 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4434 struct yahoo_data *yd; 4435 4436 if(!yid) 4437 return; 4438 yd = yid->yd; 4439 4440 struct yahoo_packet* pkt=NULL; 4441 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); 4442 4443 yahoo_packet_hash(pkt,1,me ?: yd->user); 4444 yahoo_packet_hash(pkt,5,who); 4445 // yahoo_packet_hash(pkt,241,YAHOO_PROTO_VER); 4446 yahoo_packet_hash(pkt,13,"2"); 4447 yahoo_packet_hash(pkt,334,"0"); 4448 yahoo_packet_hash(pkt,97,"1"); 4449 yahoo_packet_hash(pkt,14,msg?:""); 4450 4451 yahoo_send_packet(yid, pkt, 0); 4452 yahoo_packet_free(pkt); 4453 4091 4454 } 4092 4455 -
protocols/yahoo/yahoo.c
raac4017 r2288705 197 197 { 198 198 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 199 200 ic->away = NULL; 199 char *away; 200 201 away = NULL; 201 202 202 203 if( state && msg && g_strcasecmp( state, msg ) != 0 ) 203 204 { 204 205 yd->current_status = YAHOO_STATUS_CUSTOM; 205 ic->away = "";206 away = ""; 206 207 } 207 208 else if( state ) … … 212 213 msg = NULL; 213 214 214 ic->away = "";215 away = ""; 215 216 if( g_strcasecmp( state, "Available" ) == 0 ) 216 217 { 217 218 yd->current_status = YAHOO_STATUS_AVAILABLE; 218 ic->away = NULL;219 away = NULL; 219 220 } 220 221 else if( g_strcasecmp( state, "Be Right Back" ) == 0 ) … … 242 243 yd->current_status = YAHOO_STATUS_AVAILABLE; 243 244 244 ic->away = NULL;245 away = NULL; 245 246 } 246 247 } … … 248 249 yd->current_status = YAHOO_STATUS_AVAILABLE; 249 250 250 yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL ? 2 : 0 );251 yahoo_set_away( yd->y2_id, yd->current_status, msg, away != NULL ? 2 : 0 ); 251 252 } 252 253 253 254 static GList *byahoo_away_states( struct im_connection *ic ) 254 255 { 255 GList *m = NULL; 256 257 m = g_list_append( m, "Available" ); 258 m = g_list_append( m, "Be Right Back" ); 259 m = g_list_append( m, "Busy" ); 260 m = g_list_append( m, "Not At Home" ); 261 m = g_list_append( m, "Not At Desk" ); 262 m = g_list_append( m, "Not In Office" ); 263 m = g_list_append( m, "On Phone" ); 264 m = g_list_append( m, "On Vacation" ); 265 m = g_list_append( m, "Out To Lunch" ); 266 m = g_list_append( m, "Stepped Out" ); 267 m = g_list_append( m, "Invisible" ); 268 m = g_list_append( m, GAIM_AWAY_CUSTOM ); 256 static GList *m = NULL; 257 258 if( m == NULL ) 259 { 260 m = g_list_append( m, "Available" ); 261 m = g_list_append( m, "Be Right Back" ); 262 m = g_list_append( m, "Busy" ); 263 m = g_list_append( m, "Not At Home" ); 264 m = g_list_append( m, "Not At Desk" ); 265 m = g_list_append( m, "Not In Office" ); 266 m = g_list_append( m, "On Phone" ); 267 m = g_list_append( m, "On Vacation" ); 268 m = g_list_append( m, "Out To Lunch" ); 269 m = g_list_append( m, "Stepped Out" ); 270 m = g_list_append( m, "Invisible" ); 271 m = g_list_append( m, GAIM_AWAY_CUSTOM ); 272 } 269 273 270 274 return m; … … 345 349 346 350 return c; 351 } 352 353 static void byahoo_auth_allow( struct im_connection *ic, const char *who ) 354 { 355 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 356 357 yahoo_accept_buddy_ymsg13( yd->y2_id, NULL, who ); 358 } 359 360 static void byahoo_auth_deny( struct im_connection *ic, const char *who ) 361 { 362 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 363 364 yahoo_reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL ); 347 365 } 348 366 … … 372 390 ret->handle_cmp = g_strcasecmp; 373 391 392 ret->auth_allow = byahoo_auth_allow; 393 ret->auth_deny = byahoo_auth_deny; 394 374 395 register_protocol(ret); 375 396 } … … 451 472 struct byahoo_write_ready_data *d = data; 452 473 453 yahoo_write_ready( d->id, d->fd, d->data ); 454 455 return FALSE; 474 return yahoo_write_ready( d->id, d->fd, d->data ); 456 475 } 457 476 … … 790 809 { 791 810 struct byahoo_conf_invitation *inv = data; 792 793 yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name ); 794 imcb_chat_add_buddy( inv->c, inv->ic->acc->user ); 811 struct groupchat *b; 812 813 for( b = inv->ic->groupchats; b; b = b->next ) 814 if( b == inv->c ) 815 break; 816 817 if( b != NULL ) 818 { 819 yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name ); 820 imcb_chat_add_buddy( inv->c, inv->ic->acc->user ); 821 } 822 else 823 { 824 imcb_log( inv->ic, "Duplicate/corrupted invitation to `%s'.", inv->name ); 825 } 826 795 827 g_free( inv->name ); 796 828 g_free( inv ); … … 908 940 } 909 941 942 void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg ) 943 { 944 struct im_connection *ic = byahoo_get_ic_by_id( id ); 945 946 imcb_ask_auth( ic, who, NULL ); 947 } 948 910 949 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 911 950 { 912 /* Groups schmoups. If I want to handle groups properly I can get the913 buddy data from some internal libyahoo2 structure. */914 imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL );951 struct im_connection *ic = byahoo_get_ic_by_id( id ); 952 953 imcb_add_buddy( ic, (char*) who, NULL ); 915 954 } 916 955 -
protocols/yahoo/yahoo2.h
raac4017 r2288705 217 217 void yahoo_buddyicon_request(int id, const char *who); 218 218 219 void yahoo_accept_buddy_ymsg13(int,const char*,const char*); 220 void yahoo_reject_buddy_ymsg13(int,const char*,const char*,const char*); 221 219 222 #include "yahoo_httplib.h" 220 223 -
protocols/yahoo/yahoo2_callbacks.h
raac4017 r2288705 361 361 362 362 /* 363 * Name: ext_yahoo_contact_auth_request 364 * Called when a contact wants to add you to his/her contact list 365 * Params: 366 * id - the id that identifies the server connection 367 * myid - the identity s/he added 368 * who - who did it 369 * msg - any message sent 370 */ 371 void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg); 372 373 374 /* 363 375 * Name: ext_yahoo_contact_added 364 376 * Called when a contact is added to your list -
protocols/yahoo/yahoo2_types.h
raac4017 r2288705 57 57 YAHOO_LOGIN_LOCK = 14, 58 58 YAHOO_LOGIN_DUPL = 99, 59 YAHOO_LOGIN_SOCK = -1 59 YAHOO_LOGIN_SOCK = -1, 60 }; 61 62 enum ypacket_status { 63 YPACKET_STATUS_DISCONNECTED = -1, 64 YPACKET_STATUS_DEFAULT = 0, 65 YPACKET_STATUS_SERVERACK = 1, 66 YPACKET_STATUS_GAME = 0x2, 67 YPACKET_STATUS_AWAY = 0x4, 68 YPACKET_STATUS_CONTINUED = 0x5, 69 YPACKET_STATUS_INVISIBLE = 12, 70 YPACKET_STATUS_NOTIFY = 0x16, /* TYPING */ 71 YPACKET_STATUS_WEBLOGIN = 0x5a55aa55, 72 YPACKET_STATUS_OFFLINE = 0x5a55aa56 60 73 }; 61 74 … … 85 98 }; 86 99 87 #define YAHOO_PROTO_VER 0x00 0b100 #define YAHOO_PROTO_VER 0x0010 88 101 89 102 /* Yahoo style/color directives */ … … 115 128 YAHOO_CONNECTION_WEBCAM, 116 129 YAHOO_CONNECTION_CHATCAT, 117 YAHOO_CONNECTION_SEARCH 130 YAHOO_CONNECTION_SEARCH, 131 YAHOO_CONNECTION_AUTH, 118 132 }; 119 133 … … 131 145 /* chat member attribs */ 132 146 #define YAHOO_CHAT_MALE 0x8000 133 #define YAHOO_CHAT_FEMALE 0x10000134 147 #define YAHOO_CHAT_FEMALE 0x10000 135 148 #define YAHOO_CHAT_DUNNO 0x400
Note: See TracChangeset
for help on using the changeset viewer.