comparison libpurple/protocols/yahoo/yahoo_filexfer.c @ 20254:f379a2e9e939

applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff through 45dd8a34b6dda68660a7f026677c9478247610ad
author Richard Laager <rlaager@wiktel.com>
date Fri, 28 Sep 2007 16:58:29 +0000
parents 63b1ce39965c
children ffbd2e3e10e4
comparison
equal deleted inserted replaced
20253:6f4defb6f399 20254:f379a2e9e939
450 /* Get all the necessary values from this new packet */ 450 /* Get all the necessary values from this new packet */
451 while(l != NULL) 451 while(l != NULL)
452 { 452 {
453 struct yahoo_pair *pair = l->data; 453 struct yahoo_pair *pair = l->data;
454 454
455 if(pair->key == 5) /* Get who the packet is for */ 455 switch(pair->key) {
456 case 5: /* Get who the packet is for */
456 me = pair->value; 457 me = pair->value;
457 458 break;
458 if(pair->key == 4) /* Get who the packet is from */ 459 case 4: /* Get who the packet is from */
459 from = pair->value; 460 from = pair->value;
460 461 break;
461 if(pair->key == 49) /* Get the type of service */ 462 case 49: /* Get the type of service */
462 service = pair->value; 463 service = pair->value;
463 464 break;
464 if(pair->key == 14) /* Get the 'message' of the packet */ 465 case 14: /* Get the 'message' of the packet */
465 message = pair->value; 466 message = pair->value;
466 467 break;
467 if(pair->key == 13) /* Get the command associated with this packet */ 468 case 13: /* Get the command associated with this packet */
468 command = pair->value; 469 command = pair->value;
469 470 break;
470 if(pair->key == 63) /* IMVironment name and version */ 471 case 63: /* IMVironment name and version */
471 imv = pair->value; 472 imv = pair->value;
472 473 break;
473 if(pair->key == 64) /* Not sure, but it does vary with initialization of Doodle */ 474 case 64: /* Not sure, but it does vary with initialization of Doodle */
474 unknown = pair->value; /* So, I'll keep it (for a little while atleast) */ 475 unknown = pair->value; /* So, I'll keep it (for a little while atleast) */
476 break;
477 }
475 478
476 l = l->next; 479 l = l->next;
477 } 480 }
478 481
479 /* If this packet is an IMVIRONMENT, handle it accordingly */ 482 /* If this packet is an IMVIRONMENT, handle it accordingly */
480 if(service != NULL && imv != NULL && !strcmp(service, "IMVIRONMENT")) 483 if(service != NULL && imv != NULL && !strcmp(service, "IMVIRONMENT"))
481 { 484 {
482 /* Check for a Doodle packet and handle it accordingly */ 485 /* Check for a Doodle packet and handle it accordingly */
483 if(strstr(imv, "doodle;") != NULL) 486 if(strstr(imv, "doodle;") != NULL)
484 yahoo_doodle_process(gc, me, from, command, message); 487 yahoo_doodle_process(gc, me, from, command, message, imv);
485 488
486 /* If an IMVIRONMENT packet comes without a specific imviroment name */ 489 /* If an IMVIRONMENT packet comes without a specific imviroment name */
487 if(!strcmp(imv, ";0")) 490 if(!strcmp(imv, ";0"))
488 { 491 {
489 /* It is unfortunately time to close all IMVironments with the remote client */ 492 /* It is unfortunately time to close all IMVironments with the remote client */
511 yd = gc->proto_data; 514 yd = gc->proto_data;
512 515
513 for (l = pkt->hash; l; l = l->next) { 516 for (l = pkt->hash; l; l = l->next) {
514 struct yahoo_pair *pair = l->data; 517 struct yahoo_pair *pair = l->data;
515 518
516 if (pair->key == 4) 519 switch (pair->key) {
520 case 4:
517 from = pair->value; 521 from = pair->value;
518 if (pair->key == 5) 522 break;
523 case 5:
519 to = pair->value; 524 to = pair->value;
520 if (pair->key == 14) 525 break;
526 case 14:
521 msg = pair->value; 527 msg = pair->value;
522 if (pair->key == 20) 528 break;
529 case 20:
523 url = pair->value; 530 url = pair->value;
524 if (pair->key == 38) 531 break;
532 case 38:
525 expires = strtol(pair->value, NULL, 10); 533 expires = strtol(pair->value, NULL, 10);
526 if (pair->key == 27) 534 break;
535 case 27:
527 filename = pair->value; 536 filename = pair->value;
528 if (pair->key == 28) 537 break;
538 case 28:
529 filesize = atol(pair->value); 539 filesize = atol(pair->value);
530 if (pair->key == 49) 540 break;
541 case 49:
531 service = pair->value; 542 service = pair->value;
532 if (pair->key == 63) 543 break;
544 case 63:
533 imv = pair->value; 545 imv = pair->value;
546 break;
547 }
534 } 548 }
535 549
536 /* 550 /*
537 * The remote user has changed their IMVironment. We 551 * The remote user has changed their IMVironment. We
538 * record it for later use. 552 * record it for later use.