void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt) { GSList *l = pkt->hash; char *me = NULL; char *from = NULL; char *service = NULL; char *message = NULL; char *command = NULL; char *imv = NULL; char *unknown = NULL; /* Get all the necessary values from this new packet */ while(l != NULL) { struct yahoo_pair *pair = l->data; if(pair->key == 5) /* Get who the packet is for */ me = pair->value; if(pair->key == 4) /* Get who the packet is from */ from = pair->value; if(pair->key == 49) /* Get the type of service */ service = pair->value; if(pair->key == 14) /* Get the 'message' of the packet */ message = pair->value; if(pair->key == 13) /* Get the command associated with this packet */ command = pair->value; if(pair->key == 63) /* IMVironment name and version */ imv = pair->value; if(pair->key == 64) /* Not sure, but it does vary with initialization of Doodle */ unknown = pair->value; /* So, I'll keep it (for a little while atleast) */ l = l->next; } /* If this packet is an IMVIRONMENT, handle it accordingly */ if(service != NULL && imv != NULL && !strcmp(service, "IMVIRONMENT")) { /* Check for a Doodle packet and handle it accordingly */ if(strstr(imv, "doodle;") != NULL) yahoo_doodle_process(gc, me, from, command, message); /* If an IMVIRONMENT packet comes without a specific imviroment name */ if(!strcmp(imv, ";0")) { /* It is unfortunately time to close all IMVironments with the remote client */ yahoo_doodle_command_got_shutdown(gc, from); } } }
void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt) { GSList *l = pkt->hash; char *me = NULL; char *from = NULL; char *service = NULL; char *message = NULL; char *command = NULL; char *imv = NULL; /* Get all the necessary values from this new packet */ while(l != NULL) { struct yahoo_pair *pair = l->data; switch(pair->key) { case 5: /* Get who the packet is for */ if (g_utf8_validate(pair->value, -1, NULL)) { me = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_p2pfilexfer " "got non-UTF-8 string for key %d\n", pair->key); } break; case 4: /* Get who the packet is from */ if (g_utf8_validate(pair->value, -1, NULL)) { from = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_p2pfilexfer " "got non-UTF-8 string for key %d\n", pair->key); } break; case 49: /* Get the type of service */ if (g_utf8_validate(pair->value, -1, NULL)) { service = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_p2pfilexfer " "got non-UTF-8 string for key %d\n", pair->key); } break; case 14: /* Get the 'message' of the packet */ if (g_utf8_validate(pair->value, -1, NULL)) { message = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_p2pfilexfer " "got non-UTF-8 string for key %d\n", pair->key); } break; case 13: /* Get the command associated with this packet */ if (g_utf8_validate(pair->value, -1, NULL)) { command = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_p2pfilexfer " "got non-UTF-8 string for key %d\n", pair->key); } break; case 63: /* IMVironment name and version */ if (g_utf8_validate(pair->value, -1, NULL)) { imv = pair->value; } else { purple_debug_warning("yahoo", "yahoo_process_p2pfilexfer " "got non-UTF-8 string for key %d\n", pair->key); } break; case 64: /* Not sure, but it does vary with initialization of Doodle */ break; } l = l->next; } /* If this packet is an IMVIRONMENT, handle it accordingly */ if(service != NULL && imv != NULL && !strcmp(service, "IMVIRONMENT")) { /* Check for a Doodle packet and handle it accordingly */ if(strstr(imv, "doodle;") != NULL) yahoo_doodle_process(gc, me, from, command, message, imv); /* If an IMVIRONMENT packet comes without a specific imviroment name */ if(!strcmp(imv, ";0")) { /* It is unfortunately time to close all IMVironments with the remote client */ yahoo_doodle_command_got_shutdown(gc, from); } } }