Mercurial > pidgin.yaz
comparison src/server.c @ 2104:0b81421021fd
[gaim-migrate @ 2114]
heh. i confused myself.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 01 Aug 2001 22:06:17 +0000 |
parents | b66aca8e8dce |
children | efb39c151cf7 |
comparison
equal
deleted
inserted
replaced
2103:d403300222d2 | 2104:0b81421021fd |
---|---|
394 int plugin_return; | 394 int plugin_return; |
395 | 395 |
396 struct conversation *cnv; | 396 struct conversation *cnv; |
397 int new_conv = 0; | 397 int new_conv = 0; |
398 | 398 |
399 /* plugin stuff. we pass a char ** but we don't want to pass what's been given us | |
400 * by the prpls. so we create temp holders and pass those instead. it's basically | |
401 * just to avoid segfaults. */ | |
402 buffy = g_strdup(message); | |
403 angel = g_strdup(name); | |
404 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, 0); | |
405 | |
406 if (!buffy || !angel || plugin_return) { | |
407 if (buffy) | |
408 g_free(buffy); | |
409 if (angel) | |
410 g_free(angel); | |
411 return; | |
412 } | |
413 name = angel; | |
414 message = buffy; | |
415 | |
399 /* we should update the conversation window buttons and menu, if it exists. */ | 416 /* we should update the conversation window buttons and menu, if it exists. */ |
400 cnv = find_conversation(name); | 417 cnv = find_conversation(name); |
401 if (cnv) | 418 if (cnv) |
402 set_convo_gc(cnv, gc); | 419 set_convo_gc(cnv, gc); |
403 /* we do the new_conv check here in case any plugins decide to create it */ | 420 /* we do the new_conv check here in case any plugins decide to create it */ |
404 else | 421 else |
405 new_conv = 1; | 422 new_conv = 1; |
406 | |
407 /* plugin stuff. we pass a char ** but we don't want to pass what's been given us | |
408 * by the prpls. so we create temp holders and pass those instead. it's basically | |
409 * just to avoid segfaults. */ | |
410 buffy = g_strdup(message); | |
411 angel = g_strdup(name); | |
412 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, 0); | |
413 | |
414 if (!buffy || !angel || plugin_return) { | |
415 if (buffy) | |
416 g_free(buffy); | |
417 if (angel) | |
418 g_free(angel); | |
419 return; | |
420 } | |
421 g_snprintf(message, strlen(message) + 1, "%s", buffy); | |
422 g_free(buffy); | |
423 g_snprintf(name, strlen(name) + 1, "%s", angel); | |
424 g_free(angel); | |
425 | 423 |
426 /* TiK, using TOC, sends an automated message in order to get your away message. Now, | 424 /* TiK, using TOC, sends an automated message in order to get your away message. Now, |
427 * this is one of the biggest hacks I think I've seen. But, in order to be nice to | 425 * this is one of the biggest hacks I think I've seen. But, in order to be nice to |
428 * TiK, we're going to give users the option to ignore it. */ | 426 * TiK, we're going to give users the option to ignore it. */ |
429 if ((general_options & OPT_GEN_TIK_HACK) && gc->away && strlen(gc->away) && | 427 if ((general_options & OPT_GEN_TIK_HACK) && gc->away && strlen(gc->away) && |
430 !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) { | 428 !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) { |
431 char *tmpmsg = stylize(awaymessage->message, MSG_LEN); | 429 char *tmpmsg = stylize(awaymessage->message, MSG_LEN); |
432 serv_send_im(gc, name, tmpmsg, 1); | 430 serv_send_im(gc, name, tmpmsg, 1); |
433 g_free(tmpmsg); | 431 g_free(tmpmsg); |
432 g_free(name); | |
433 g_free(message); | |
434 return; | 434 return; |
435 } | 435 } |
436 | 436 |
437 /* if you can't figure this out, stop reading right now. | 437 /* if you can't figure this out, stop reading right now. |
438 * "we're not worthy! we're not worthy!" */ | 438 * "we're not worthy! we're not worthy!" */ |
495 } | 495 } |
496 } else { | 496 } else { |
497 /* ok, so we're not queuing it. well then, we'll try to handle it normally. | 497 /* ok, so we're not queuing it. well then, we'll try to handle it normally. |
498 * Some people think that ignoring it is a perfectly acceptible way to handle | 498 * Some people think that ignoring it is a perfectly acceptible way to handle |
499 * it. i think they're on crack, but hey, that's why it's optional. */ | 499 * it. i think they're on crack, but hey, that's why it's optional. */ |
500 if (general_options & OPT_GEN_DISCARD_WHEN_AWAY) | 500 if (general_options & OPT_GEN_DISCARD_WHEN_AWAY) { |
501 g_free(name); | |
502 g_free(message); | |
501 return; | 503 return; |
504 } | |
502 | 505 |
503 /* ok, so we're not ignoring it. make sure the conversation exists and is | 506 /* ok, so we're not ignoring it. make sure the conversation exists and is |
504 * updated (partly handled above already), play the receive sound (sound.c | 507 * updated (partly handled above already), play the receive sound (sound.c |
505 * will take care of not playing while away), and then write it to the | 508 * will take care of not playing while away), and then write it to the |
506 * convo window. */ | 509 * convo window. */ |
516 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); | 519 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); |
517 } | 520 } |
518 | 521 |
519 /* regardless of whether we queue it or not, we should send an auto-response. That is, | 522 /* regardless of whether we queue it or not, we should send an auto-response. That is, |
520 * of course, unless the horse.... no wait. */ | 523 * of course, unless the horse.... no wait. */ |
521 if ((general_options & OPT_GEN_NO_AUTO_RESP) || !strlen(gc->away)) | 524 if ((general_options & OPT_GEN_NO_AUTO_RESP) || !strlen(gc->away)) { |
525 g_free(name); | |
526 g_free(message); | |
522 return; | 527 return; |
528 } | |
523 | 529 |
524 /* this used to be based on the conversation window. but um, if you went away, and | 530 /* this used to be based on the conversation window. but um, if you went away, and |
525 * someone sent you a message and got your auto-response, and then you closed the | 531 * someone sent you a message and got your auto-response, and then you closed the |
526 * window, and then the sent you another one, they'd get the auto-response back | 532 * window, and then the sent you another one, they'd get the auto-response back |
527 * too soon. besides that, we need to keep track of this even if we've got a queue. | 533 * too soon. besides that, we need to keep track of this even if we've got a queue. |
531 qar = (struct queued_away_response *)g_new0(struct queued_away_response, 1); | 537 qar = (struct queued_away_response *)g_new0(struct queued_away_response, 1); |
532 g_snprintf(qar->name, sizeof(qar->name), "%s", name); | 538 g_snprintf(qar->name, sizeof(qar->name), "%s", name); |
533 qar->sent_away = 0; | 539 qar->sent_away = 0; |
534 away_time_queue = g_slist_append(away_time_queue, qar); | 540 away_time_queue = g_slist_append(away_time_queue, qar); |
535 } | 541 } |
536 if ((t - qar->sent_away) < 120) | 542 if ((t - qar->sent_away) < 120) { |
543 g_free(name); | |
544 g_free(message); | |
537 return; | 545 return; |
546 } | |
538 qar->sent_away = t; | 547 qar->sent_away = t; |
539 | 548 |
540 /* apply default fonts and colors */ | 549 /* apply default fonts and colors */ |
541 tmpmsg = stylize(gc->away, MSG_LEN); | 550 tmpmsg = stylize(gc->away, MSG_LEN); |
542 serv_send_im(gc, name, away_subs(tmpmsg, alias), 1); | 551 serv_send_im(gc, name, away_subs(tmpmsg, alias), 1); |
565 else if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) | 574 else if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) |
566 play_sound(RECEIVE); | 575 play_sound(RECEIVE); |
567 | 576 |
568 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); | 577 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); |
569 } | 578 } |
579 | |
580 plugin_event(event_im_displayed_rcvd, gc, name, message, 0); | |
581 g_free(name); | |
582 g_free(message); | |
570 } | 583 } |
571 | 584 |
572 | 585 |
573 | 586 |
574 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, | 587 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, |