Changeset ba16895
- Timestamp:
- 2009-10-10T13:48:44Z (15 years ago)
- Branches:
- master
- Children:
- 037b66a
- Parents:
- fa295e36
- Location:
- protocols/yahoo
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/yahoo/libyahoo2.c
rfa295e36 rba16895 212 212 YAHOO_SERVICE_CHATPING, 213 213 YAHOO_SERVICE_COMMENT = 0xa8, 214 YAHOO_SERVICE_GAME_INVITE = 0xb7, 215 YAHOO_SERVICE_STEALTH_PERM = 0xb9, 216 YAHOO_SERVICE_STEALTH_SESSION = 0xba, 217 YAHOO_SERVICE_AVATAR = 0xbc, 214 YAHOO_SERVICE_STEALTH = 0xb9, 218 215 YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd, 219 216 YAHOO_SERVICE_PICTURE = 0xbe, 220 217 YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, 221 218 YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2, 222 YAHOO_SERVICE_YAB_UPDATE = 0xc4, 223 YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5, /* YMSG13, key 13: 2 = invisible, 1 = visible */ 224 YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6, /* YMSG13 */ 225 YAHOO_SERVICE_PICTURE_STATUS = 0xc7, /* YMSG13, key 213: 0 = none, 1 = avatar, 2 = picture */ 226 YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8, 227 YAHOO_SERVICE_AUDIBLE = 0xd0, 228 YAHOO_SERVICE_Y7_PHOTO_SHARING = 0xd2, 229 YAHOO_SERVICE_Y7_CONTACT_DETAILS = 0xd3,/* YMSG13 */ 230 YAHOO_SERVICE_Y7_CHAT_SESSION = 0xd4, 231 YAHOO_SERVICE_Y7_AUTHORIZATION = 0xd6, /* YMSG13 */ 232 YAHOO_SERVICE_Y7_FILETRANSFER = 0xdc, /* YMSG13 */ 233 YAHOO_SERVICE_Y7_FILETRANSFERINFO, /* YMSG13 */ 234 YAHOO_SERVICE_Y7_FILETRANSFERACCEPT, /* YMSG13 */ 235 YAHOO_SERVICE_Y7_MINGLE = 0xe1, /* YMSG13 */ 236 YAHOO_SERVICE_Y7_CHANGE_GROUP = 0xe7, /* YMSG13 */ 237 YAHOO_SERVICE_Y8_STATUS = 0xf0, /* YMSG15 */ 238 YAHOO_SERVICE_Y8_LIST = 0Xf1, /* YMSG15 */ 239 YAHOO_SERVICE_WEBLOGIN = 0x0226, 240 YAHOO_SERVICE_SMS_MSG = 0x02ea 219 YAHOO_SERVICE_Y6_VISIBILITY=0xc5, 220 YAHOO_SERVICE_Y6_STATUS_UPDATE=0xc6, 221 YAHOO_PHOTOSHARE_INIT=0xd2, 222 YAHOO_SERVICE_CONTACT_YMSG13=0xd6, 223 YAHOO_PHOTOSHARE_PREV=0xd7, 224 YAHOO_PHOTOSHARE_KEY=0xd8, 225 YAHOO_PHOTOSHARE_TRANS=0xda, 226 YAHOO_FILE_TRANSFER_INIT_YMSG13=0xdc, 227 YAHOO_FILE_TRANSFER_GET_YMSG13=0xdd, 228 YAHOO_FILE_TRANSFER_PUT_YMSG13=0xde, 229 YAHOO_SERVICE_YMSG15_STATUS=0xf0, 230 YAHOO_SERVICE_YMSG15_BUDDY_LIST=0xf1, 241 231 }; 242 232 … … 776 766 yahoo_send_data(yid->fd, data, len); 777 767 else 778 yahoo_add_to_send_queue(yid, data, len);768 yahoo_add_to_send_queue(yid, data, len); 779 769 FREE(data); 780 770 } … … 1496 1486 1497 1487 if (u->name != NULL) { 1498 if (pkt->service == YAHOO_SERVICE_LOGOFF || u->flags == 0) {1488 if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */ 1499 1489 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0); 1500 1490 } else { 1491 /* Key 47 always seems to be 1 for YMSG16 */ 1492 if(!u->state) 1493 u->away = 0; 1494 else 1495 u->away = 1; 1496 1501 1497 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile); 1502 1498 } … … 2515 2511 2516 2512 yd->buddies = y_list_append(yd->buddies, bud); 2517 2513 2518 2514 /* Possibly called already, but at least the call above doesn't 2519 2515 seem to happen every time (not anytime I tried). */ … … 2522 2518 2523 2519 /* YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */ 2520 } 2521 2522 static void yahoo_process_contact_ymsg13(struct yahoo_input_data *yid, struct yahoo_packet *pkt) 2523 { 2524 char* who=NULL; 2525 char* me=NULL; 2526 char* msg=NULL; 2527 YList *l; 2528 for (l = pkt->hash; l; l = l->next) { 2529 struct yahoo_pair *pair = l->data; 2530 if (pair->key == 4) 2531 who = pair->value; 2532 else if (pair->key == 5) 2533 me = pair->value; 2534 else 2535 DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value)); 2536 } 2537 2538 if(pkt->status==3) 2539 YAHOO_CALLBACK(ext_yahoo_contact_auth_request)(yid->yd->client_id, me, who, msg); 2524 2540 } 2525 2541 … … 2735 2751 2736 2752 YList *l; 2737 yahoo_dump_unhandled(pkt);2753 // yahoo_dump_unhandled(pkt); 2738 2754 for (l = pkt->hash; l; l = l->next) { 2739 2755 struct yahoo_pair *pair = l->data; … … 2757 2773 { 2758 2774 DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service)); 2775 yahoo_dump_unhandled(pkt); 2759 2776 switch (pkt->service) 2760 2777 { … … 2769 2786 case YAHOO_SERVICE_IDDEACT: 2770 2787 case YAHOO_SERVICE_Y6_STATUS_UPDATE: 2771 case YAHOO_SERVICE_Y 8_STATUS:2788 case YAHOO_SERVICE_YMSG15_STATUS: 2772 2789 yahoo_process_status(yid, pkt); 2773 2790 break; … … 2783 2800 yahoo_process_mail(yid, pkt); 2784 2801 break; 2802 case YAHOO_SERVICE_REJECTCONTACT: 2785 2803 case YAHOO_SERVICE_NEWCONTACT: 2786 2804 yahoo_process_contact(yid, pkt); … … 2823 2841 yahoo_process_buddyadd(yid, pkt); 2824 2842 break; 2843 case YAHOO_SERVICE_CONTACT_YMSG13: 2844 yahoo_process_contact_ymsg13(yid,pkt); 2845 break; 2825 2846 case YAHOO_SERVICE_REMBUDDY: 2826 2847 yahoo_process_buddydel(yid, pkt); … … 2851 2872 case YAHOO_SERVICE_CHATLOGOFF: 2852 2873 case YAHOO_SERVICE_CHATMSG: 2853 case YAHOO_SERVICE_REJECTCONTACT:2854 2874 case YAHOO_SERVICE_PEERTOPEER: 2855 2875 WARNING(("unhandled service 0x%02x", pkt->service)); … … 2865 2885 yahoo_process_picture_upload(yid, pkt); 2866 2886 break; 2867 case YAHOO_SERVICE_Y 8_LIST: /* Buddy List */2887 case YAHOO_SERVICE_YMSG15_BUDDY_LIST: /* Buddy List */ 2868 2888 yahoo_process_buddy_list(yid, pkt); 2869 2889 default: … … 4045 4065 4046 4066 yahoo_packet_hash(pkt, 5, who); 4047 yahoo_packet_hash(pkt, 4, from?from:yd->user);4067 yahoo_packet_hash(pkt, 1, from?from:yd->user); 4048 4068 yahoo_packet_hash(pkt, 14, " "); 4049 4069 yahoo_packet_hash(pkt, 13, typ ? "1" : "0"); … … 4347 4367 return; 4348 4368 4349 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); 4350 yahoo_packet_hash(pkt, 1, yd->user); 4351 yahoo_packet_hash(pkt, 7, who); 4352 yahoo_packet_hash(pkt, 65, group); 4369 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YPACKET_STATUS_DEFAULT, yd->session_id); 4370 4353 4371 if (msg != NULL) /* add message/request "it's me add me" */ 4354 4372 yahoo_packet_hash(pkt, 14, msg); 4373 else 4374 yahoo_packet_hash(pkt,14,""); 4375 4376 yahoo_packet_hash(pkt, 65, group); 4377 yahoo_packet_hash(pkt, 97, "1"); 4378 yahoo_packet_hash(pkt, 1, yd->user); 4379 yahoo_packet_hash(pkt, 302, "319"); 4380 yahoo_packet_hash(pkt, 300, "319"); 4381 yahoo_packet_hash(pkt, 7, who); 4382 yahoo_packet_hash(pkt, 334, "0"); 4383 yahoo_packet_hash(pkt, 301, "319"); 4384 yahoo_packet_hash(pkt, 303, "319"); 4385 4386 4355 4387 yahoo_send_packet(yid, pkt, 0); 4356 4388 yahoo_packet_free(pkt); … … 4374 4406 yahoo_send_packet(yid, pkt, 0); 4375 4407 yahoo_packet_free(pkt); 4408 } 4409 4410 void yahoo_accept_buddy_ymsg13(int id,const char* me,const char* who){ 4411 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4412 struct yahoo_data *yd; 4413 4414 if(!yid) 4415 return; 4416 yd = yid->yd; 4417 4418 struct yahoo_packet* pkt=NULL; 4419 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); 4420 4421 yahoo_packet_hash(pkt,1,me ?: yd->user); 4422 yahoo_packet_hash(pkt,5,who); 4423 yahoo_packet_hash(pkt,13,"1"); 4424 yahoo_packet_hash(pkt,334,"0"); 4425 yahoo_send_packet(yid, pkt, 0); 4426 yahoo_packet_free(pkt); 4427 } 4428 4429 void yahoo_reject_buddy_ymsg13(int id,const char* me,const char* who,const char* msg){ 4430 struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); 4431 struct yahoo_data *yd; 4432 4433 if(!yid) 4434 return; 4435 yd = yid->yd; 4436 4437 struct yahoo_packet* pkt=NULL; 4438 pkt= yahoo_packet_new(YAHOO_SERVICE_CONTACT_YMSG13,YAHOO_STATUS_AVAILABLE,0); 4439 4440 yahoo_packet_hash(pkt,1,me ?: yd->user); 4441 yahoo_packet_hash(pkt,5,who); 4442 // yahoo_packet_hash(pkt,241,YAHOO_PROTO_VER); 4443 yahoo_packet_hash(pkt,13,"2"); 4444 yahoo_packet_hash(pkt,334,"0"); 4445 yahoo_packet_hash(pkt,97,"1"); 4446 yahoo_packet_hash(pkt,14,msg?:""); 4447 4448 yahoo_send_packet(yid, pkt, 0); 4449 yahoo_packet_free(pkt); 4450 4376 4451 } 4377 4452 … … 4431 4506 return; 4432 4507 4433 pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH _PERM, YAHOO_STATUS_AVAILABLE, yd->session_id);4508 pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH, YAHOO_STATUS_AVAILABLE, yd->session_id); 4434 4509 yahoo_packet_hash(pkt, 1, yd->user); 4435 4510 yahoo_packet_hash(pkt, 7, who); -
protocols/yahoo/yahoo.c
rfa295e36 rba16895 348 348 } 349 349 350 static void byahoo_auth_allow( struct im_connection *ic, const char *who ) 351 { 352 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 353 354 yahoo_accept_buddy_ymsg13( yd->y2_id, NULL, who ); 355 } 356 357 static void byahoo_auth_deny( struct im_connection *ic, const char *who ) 358 { 359 struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data; 360 361 yahoo_reject_buddy_ymsg13( yd->y2_id, NULL, who, NULL ); 362 } 363 350 364 void byahoo_initmodule( ) 351 365 { … … 372 386 373 387 ret->handle_cmp = g_strcasecmp; 388 389 ret->auth_allow = byahoo_auth_allow; 390 ret->auth_deny = byahoo_auth_deny; 374 391 375 392 register_protocol(ret); … … 922 939 } 923 940 941 void ext_yahoo_contact_auth_request( int id, const char *myid, const char *who, const char *msg ) 942 { 943 struct im_connection *ic = byahoo_get_ic_by_id( id ); 944 945 imcb_ask_auth( ic, who, NULL ); 946 } 947 924 948 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 925 949 { 926 /* Groups schmoups. If I want to handle groups properly I can get the927 buddy data from some internal libyahoo2 structure. */928 imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL );950 struct im_connection *ic = byahoo_get_ic_by_id( id ); 951 952 imcb_add_buddy( ic, (char*) who, NULL ); 929 953 } 930 954 -
protocols/yahoo/yahoo2.h
rfa295e36 rba16895 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
rfa295e36 rba16895 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
rfa295e36 rba16895 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 … … 133 146 #define YAHOO_CHAT_MALE 0x8000 134 147 #define YAHOO_CHAT_FEMALE 0x10000 135 #define YAHOO_CHAT_FEMALE 0x10000136 148 #define YAHOO_CHAT_DUNNO 0x400 137 149 #define YAHOO_CHAT_WEBCAM 0x10
Note: See TracChangeset
for help on using the changeset viewer.