comparison src/server.c @ 2273:0b5c3338fa3d

[gaim-migrate @ 2283] One of the girls on the floor of my sister's dorm lost both her parents when their plane was hijacked and crashed into the World Trade Center. my girlfriend's boss's sister-in-law's brother died when the building collapsed. my parents flew to atlanta on monday; they're safe but currently stranded there. they had planned on flying to Raleigh, NC today but now are just hoping to be able to fly home soon. how did this happen? committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 12 Sep 2001 21:29:32 +0000
parents 8c4ff1a368bd
children 38e156136896
comparison
equal deleted inserted replaced
2272:4ecc9a9a75d8 2273:0b5c3338fa3d
385 385
386 return NULL; 386 return NULL;
387 } 387 }
388 388
389 /* woo. i'm actually going to comment this function. isn't that fun. make sure to follow along, kids */ 389 /* woo. i'm actually going to comment this function. isn't that fun. make sure to follow along, kids */
390 void serv_got_im(struct gaim_connection *gc, char *name, char *message, int away, time_t mtime) 390 void serv_got_im(struct gaim_connection *gc, char *name, char *message, guint32 flags, time_t mtime)
391 { 391 {
392 char *buffy; 392 char *buffy;
393 char *angel; 393 char *angel;
394 int plugin_return; 394 int plugin_return;
395 int away = 0;
395 396
396 struct conversation *cnv; 397 struct conversation *cnv;
397 int new_conv = 0; 398 int new_conv = 0;
399
400 /* pay no attention to the man behind the curtain.
401 *
402 * the reason i feel okay with this is because it's useful to some plugins.
403 * Gaim doesn't ever use it itself. Besides, it's not entirely accurate; it's
404 * possible to have false negatives with most protocols. Also with some it's
405 * easy to have false positives as well. So if you're a plugin author, don't
406 * rely on this, still do your own checks. but uh. it's a start. */
407 if (flags & IM_FLAG_GAIMUSER)
408 debug_printf("%s is a gaim user.\n", name);
398 409
399 /* we should update the conversation window buttons and menu, if it exists. */ 410 /* we should update the conversation window buttons and menu, if it exists. */
400 cnv = find_conversation(name); 411 cnv = find_conversation(name);
401 if (cnv) 412 if (cnv)
402 set_convo_gc(cnv, gc); 413 set_convo_gc(cnv, gc);
408 * by the prpls. so we create temp holders and pass those instead. it's basically 419 * by the prpls. so we create temp holders and pass those instead. it's basically
409 * just to avoid segfaults. */ 420 * just to avoid segfaults. */
410 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); 421 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG));
411 strcpy(buffy, message); 422 strcpy(buffy, message);
412 angel = g_strdup(name); 423 angel = g_strdup(name);
413 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, 0); 424 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, (void *)flags);
414 425
415 if (!buffy || !angel || plugin_return) { 426 if (!buffy || !angel || plugin_return) {
416 if (buffy) 427 if (buffy)
417 g_free(buffy); 428 g_free(buffy);
418 if (angel) 429 if (angel)
441 linkify_text(message); 452 linkify_text(message);
442 453
443 /* um. when we call write_to_conv with the message we received, it's nice to pass whether 454 /* um. when we call write_to_conv with the message we received, it's nice to pass whether
444 * or not it was an auto-response. so if it was an auto-response, we set the appropriate 455 * or not it was an auto-response. so if it was an auto-response, we set the appropriate
445 * flag. this is just so prpls don't have to know about WFLAG_* (though some do anyway) */ 456 * flag. this is just so prpls don't have to know about WFLAG_* (though some do anyway) */
446 if (away) 457 if (flags & IM_FLAG_AWAY)
447 away = WFLAG_AUTO; 458 away = WFLAG_AUTO;
448 459
449 /* alright. two cases for how to handle this. either we're away or we're not. if we're not, 460 /* alright. two cases for how to handle this. either we're away or we're not. if we're not,
450 * then it's easy. if we are, then there are three or four different ways of handling it 461 * then it's easy. if we are, then there are three or four different ways of handling it
451 * and different things we have to do for each. */ 462 * and different things we have to do for each. */
576 play_sound(RECEIVE); 587 play_sound(RECEIVE);
577 588
578 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); 589 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime);
579 } 590 }
580 591
581 plugin_event(event_im_displayed_rcvd, gc, name, message, 0); 592 plugin_event(event_im_displayed_rcvd, gc, name, message, (void *)flags);
582 g_free(name); 593 g_free(name);
583 g_free(message); 594 g_free(message);
584 } 595 }
585 596
586 597
633 } 644 }
634 } 645 }
635 cnv = cnv->next; 646 cnv = cnv->next;
636 } 647 }
637 g_free(who); 648 g_free(who);
649 who = g_strdup(b->name);
638 g_snprintf(b->name, sizeof(b->name), "%s", name); 650 g_snprintf(b->name, sizeof(b->name), "%s", name);
651 handle_buddy_rename(b, who);
652 g_free(who);
639 /*gtk_label_set_text(GTK_LABEL(b->label), b->name); */ 653 /*gtk_label_set_text(GTK_LABEL(b->label), b->name); */
640 654
641 /* okay lets save the new config... */ 655 /* okay lets save the new config... */
642 656
643 } 657 }