| 299 |
302 |
| 300 char *buffy = g_strdup(message); |
303 char *buffy = g_strdup(message); |
| 301 char *angel = g_strdup(name); |
304 char *angel = g_strdup(name); |
| 302 int plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, 0); |
305 int plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, 0); |
| 303 if (!buffy || !angel || plugin_return) { |
306 if (!buffy || !angel || plugin_return) { |
| 304 if (buffy) g_free(buffy); |
307 if (buffy) |
| 305 if (angel) g_free(angel); |
308 g_free(buffy); |
| |
309 if (angel) |
| |
310 g_free(angel); |
| 306 return; |
311 return; |
| 307 } |
312 } |
| 308 g_snprintf(message, strlen(message) + 1, "%s", buffy); |
313 g_snprintf(message, strlen(message) + 1, "%s", buffy); |
| 309 g_free(buffy); |
314 g_free(buffy); |
| 310 g_snprintf(name, strlen(name) + 1, "%s", angel); |
315 g_snprintf(name, strlen(name) + 1, "%s", angel); |
| 311 g_free(angel); |
316 g_free(angel); |
| 312 |
317 |
| 313 if ((general_options & OPT_GEN_TIK_HACK) && awaymessage && |
318 if ((general_options & OPT_GEN_TIK_HACK) && awaymessage && |
| 314 !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) |
319 !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) { |
| 315 { |
|
| 316 char *tmpmsg = stylize(awaymessage->message, MSG_LEN); |
320 char *tmpmsg = stylize(awaymessage->message, MSG_LEN); |
| 317 serv_send_im(gc, name, tmpmsg, 1); |
321 serv_send_im(gc, name, tmpmsg, 1); |
| 318 g_free(tmpmsg); |
322 g_free(tmpmsg); |
| 319 return; |
323 return; |
| 320 } |
324 } |
| 321 |
325 |
| 322 cnv = find_conversation(name); |
326 cnv = find_conversation(name); |
| 323 |
327 |
| 324 if (general_options & OPT_GEN_SEND_LINKS) { |
328 if (general_options & OPT_GEN_SEND_LINKS) { |
| 325 linkify_text(message); |
329 linkify_text(message); |
| 326 } |
330 } |
| 327 |
331 |
| 328 if (away) |
332 if (away) |
| 329 away = WFLAG_AUTO; |
333 away = WFLAG_AUTO; |
| 330 |
334 |
| 331 if (awaymessage != NULL) { |
335 if (awaymessage != NULL) { |
| 332 if (!(general_options & OPT_GEN_DISCARD_WHEN_AWAY)) { |
336 if (!(general_options & OPT_GEN_DISCARD_WHEN_AWAY)) { |
| 388 g_free(tmpmsg); |
392 g_free(tmpmsg); |
| 389 tmpmsg = stylize(awaymessage->message, MSG_LEN); |
393 tmpmsg = stylize(awaymessage->message, MSG_LEN); |
| 390 |
394 |
| 391 if (is_idle == -1) |
395 if (is_idle == -1) |
| 392 is_idle = 1; |
396 is_idle = 1; |
| 393 |
397 |
| 394 if (cnv != NULL) |
398 if (cnv != NULL) |
| 395 write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL); |
399 write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL); |
| 396 g_free(tmpmsg); |
400 g_free(tmpmsg); |
| 397 } |
401 } |
| 398 } |
402 } |
| 399 |
403 |
| 400 |
404 |
| 401 |
405 |
| 402 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, time_t idle, int type, gushort caps) |
406 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, |
| 403 { |
407 time_t idle, int type, gushort caps) |
| 404 struct buddy *b = find_buddy(gc, name); |
408 { |
| |
409 struct buddy *b = find_buddy(gc, name); |
| 405 struct gaim_connection *g = find_gaim_conn_by_name(name); |
410 struct gaim_connection *g = find_gaim_conn_by_name(name); |
| 406 |
411 |
| 407 if (g) { |
412 if (g) { |
| 408 gc->correction_time = (int)(signon - g->login_time); |
413 gc->correction_time = (int)(signon - g->login_time); |
| 409 if (!b) { |
414 if (!b) { |
| 410 return; |
415 return; |
| 411 } |
416 } |
| 412 } |
417 } |
| 413 |
418 |
| 414 if (!b) { |
419 if (!b) { |
| 415 debug_printf("Error, no such person\n"); |
420 debug_printf("Error, no such person\n"); |
| 416 return; |
421 return; |
| 417 } |
422 } |
| 418 |
423 |
| 419 /* This code will 'align' the name from the TOC */ |
424 /* This code will 'align' the name from the TOC */ |
| 420 /* server with what's in our record. We want to */ |
425 /* server with what's in our record. We want to */ |
| 421 /* store things how THEY want it... */ |
426 /* store things how THEY want it... */ |
| 422 if (strcmp(name, b->name)) { |
427 if (strcmp(name, b->name)) { |
| 423 GList *cnv = conversations; |
428 GList *cnv = conversations; |
| 424 struct conversation *cv; |
429 struct conversation *cv; |
| 425 |
430 |
| 426 char *who = g_malloc(80); |
431 char *who = g_malloc(80); |
| 427 |
432 |
| 428 strcpy(who, normalize(name)); |
433 strcpy(who, normalize(name)); |
| 429 |
434 |
| 430 while(cnv) { |
435 while (cnv) { |
| 431 cv = (struct conversation *)cnv->data; |
436 cv = (struct conversation *)cnv->data; |
| 432 if (!strcasecmp(who, normalize(cv->name))) { |
437 if (!strcasecmp(who, normalize(cv->name))) { |
| 433 g_snprintf(cv->name, sizeof(cv->name), "%s", name); |
438 g_snprintf(cv->name, sizeof(cv->name), "%s", name); |
| 434 if (find_log_info(name) || (general_options & OPT_GEN_LOG_ALL)) |
439 if (find_log_info(name) || (general_options & OPT_GEN_LOG_ALL)) |
| 435 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name); |
440 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name); |
| 436 else |
441 else |
| 437 g_snprintf(who, 63, CONVERSATION_TITLE, name); |
442 g_snprintf(who, 63, CONVERSATION_TITLE, name); |
| 438 gtk_window_set_title(GTK_WINDOW(cv->window), who); |
443 gtk_window_set_title(GTK_WINDOW(cv->window), who); |
| 439 /* was g_free(buf), but break gives us that |
444 /* was g_free(buf), but break gives us that |
| 440 * and freeing twice is not good --Sumner */ |
445 * and freeing twice is not good --Sumner */ |
| 441 break; |
446 break; |
| 442 } |
447 } |
| 443 cnv = cnv->next; |
448 cnv = cnv->next; |
| 444 } |
449 } |
| 445 g_free(who); |
450 g_free(who); |
| 446 g_snprintf(b->name, sizeof(b->name), "%s", name); |
451 g_snprintf(b->name, sizeof(b->name), "%s", name); |
| 447 /*gtk_label_set_text(GTK_LABEL(b->label), b->name);*/ |
452 /*gtk_label_set_text(GTK_LABEL(b->label), b->name); */ |
| 448 |
453 |
| 449 /* okay lets save the new config... */ |
454 /* okay lets save the new config... */ |
| 450 |
455 |
| 451 } |
456 } |
| 452 |
457 |
| 453 if (!b->idle && idle) plugin_event(event_buddy_idle, gc, b->name, 0, 0); |
458 if (!b->idle && idle) |
| |
459 plugin_event(event_buddy_idle, gc, b->name, 0, 0); |
| 454 if (b->idle && !idle) { |
460 if (b->idle && !idle) { |
| 455 do_pounce(b->name, OPT_POUNCE_UNIDLE); |
461 do_pounce(b->name, OPT_POUNCE_UNIDLE); |
| 456 plugin_event(event_buddy_unidle, gc, b->name, 0, 0); |
462 plugin_event(event_buddy_unidle, gc, b->name, 0, 0); |
| 457 } |
463 } |
| 458 |
464 |
| 459 b->idle = idle; |
465 b->idle = idle; |
| 460 b->evil = evil; |
466 b->evil = evil; |
| 461 |
467 |
| 462 if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) { |
468 if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) { |
| 463 do_pounce(b->name, OPT_POUNCE_UNAWAY); |
469 do_pounce(b->name, OPT_POUNCE_UNAWAY); |
| 464 plugin_event(event_buddy_back, gc, b->name, 0, 0); |
470 plugin_event(event_buddy_back, gc, b->name, 0, 0); |
| 465 } else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) { |
471 } else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) { |
| 466 plugin_event(event_buddy_away, gc, b->name, 0, 0); |
472 plugin_event(event_buddy_away, gc, b->name, 0, 0); |
| 467 } |
473 } |
| 468 |
474 |
| 469 b->uc = type; |
475 b->uc = type; |
| 470 if (caps) b->caps = caps; |
476 if (caps) |
| 471 |
477 b->caps = caps; |
| 472 b->signon = signon; |
478 |
| 473 |
479 b->signon = signon; |
| 474 if (loggedin) { |
480 |
| 475 if (!b->present) { |
481 if (loggedin) { |
| 476 b->present = 1; |
482 if (!b->present) { |
| 477 do_pounce(b->name, OPT_POUNCE_SIGNON); |
483 b->present = 1; |
| |
484 do_pounce(b->name, OPT_POUNCE_SIGNON); |
| 478 plugin_event(event_buddy_signon, gc, b->name, 0, 0); |
485 plugin_event(event_buddy_signon, gc, b->name, 0, 0); |
| 479 } |
486 } |
| 480 } else { |
487 } else { |
| 481 if (b->present) |
488 if (b->present) |
| 482 plugin_event(event_buddy_signoff, gc, b->name, 0, 0); |
489 plugin_event(event_buddy_signoff, gc, b->name, 0, 0); |
| 483 b->present = 0; |
490 b->present = 0; |
| 484 } |
491 } |
| 485 |
492 |
| 486 set_buddy(gc, b); |
493 set_buddy(gc, b); |
| 487 } |
494 } |
| 488 |
495 |
| 489 static |
496 static |
| 490 void close_warned(GtkWidget *w, GtkWidget *w2) |
497 void close_warned(GtkWidget *w, GtkWidget *w2) |
| 491 { |
498 { |
| 492 gtk_widget_destroy(w2); |
499 gtk_widget_destroy(w2); |
| 493 } |
500 } |
| 494 |
501 |
| 495 |
502 |
| 496 |
503 |
| 497 void serv_got_eviled(struct gaim_connection *gc, char *name, int lev) |
504 void serv_got_eviled(struct gaim_connection *gc, char *name, int lev) |
| 498 { |
505 { |
| 499 char *buf2 = g_malloc(1024); |
506 char *buf2 = g_malloc(1024); |
| 500 GtkWidget *d, *label, *close; |
507 GtkWidget *d, *label, *close; |
| 501 |
508 |
| 502 |
509 |
| 503 plugin_event(event_warned, gc, name, (void *)lev, 0); |
510 plugin_event(event_warned, gc, name, (void *)lev, 0); |
| 504 |
511 |
| 505 g_snprintf(buf2, 1023, "%s have just been warned by %s.\nYour new warning level is %d%%", |
512 g_snprintf(buf2, 1023, "%s have just been warned by %s.\nYour new warning level is %d%%", |
| 506 gc->username, ((name == NULL) ? "an anonymous person" : name) , lev); |
513 gc->username, ((name == NULL)? "an anonymous person" : name), lev); |
| 507 |
514 |
| 508 |
515 |
| 509 d = gtk_dialog_new(); |
516 d = gtk_dialog_new(); |
| 510 gtk_widget_realize(d); |
517 gtk_widget_realize(d); |
| 511 aol_icon(d->window); |
518 aol_icon(d->window); |
| 512 |
519 |
| 513 label = gtk_label_new(buf2); |
520 label = gtk_label_new(buf2); |
| 514 gtk_widget_show(label); |
521 gtk_widget_show(label); |
| 515 close = gtk_button_new_with_label("Close"); |
522 close = gtk_button_new_with_label("Close"); |
| 516 if (display_options & OPT_DISP_COOL_LOOK) |
523 if (display_options & OPT_DISP_COOL_LOOK) |
| 517 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
524 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
| 518 gtk_widget_show(close); |
525 gtk_widget_show(close); |
| 519 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), |
526 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), label, FALSE, FALSE, 5); |
| 520 label, FALSE, FALSE, 5); |
527 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), close, FALSE, FALSE, 5); |
| 521 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), |
528 |
| 522 close, FALSE, FALSE, 5); |
529 gtk_window_set_title(GTK_WINDOW(d), "Warned"); |
| 523 |
530 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_warned), d); |
| 524 gtk_window_set_title(GTK_WINDOW(d), "Warned"); |
531 gtk_widget_show(d); |
| 525 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_warned), d); |
|
| 526 gtk_widget_show(d); |
|
| 527 } |
532 } |
| 528 |
533 |
| 529 |
534 |
| 530 |
535 |
| 531 static void close_invite(GtkWidget *w, GtkWidget *w2) |
536 static void close_invite(GtkWidget *w, GtkWidget *w2) |
| 552 |
557 |
| 553 |
558 |
| 554 |
559 |
| 555 void serv_got_chat_invite(struct gaim_connection *g, char *name, int id, char *who, char *message) |
560 void serv_got_chat_invite(struct gaim_connection *g, char *name, int id, char *who, char *message) |
| 556 { |
561 { |
| 557 GtkWidget *d; |
562 GtkWidget *d; |
| 558 GtkWidget *label; |
563 GtkWidget *label; |
| 559 GtkWidget *yesbtn; |
564 GtkWidget *yesbtn; |
| 560 GtkWidget *nobtn; |
565 GtkWidget *nobtn; |
| 561 |
566 |
| 562 char buf2[BUF_LONG]; |
567 char buf2[BUF_LONG]; |
| 563 |
568 |
| 564 |
569 |
| 565 plugin_event(event_chat_invited, g, who, name, message); |
570 plugin_event(event_chat_invited, g, who, name, message); |
| 566 |
571 |
| 567 if (message) |
572 if (message) |
| 568 g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n%s", who, g->username, name, message); |
573 g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n%s", who, |
| |
574 g->username, name, message); |
| 569 else |
575 else |
| 570 g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n", who, g->username, name); |
576 g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n", who, |
| 571 |
577 g->username, name); |
| 572 d = gtk_dialog_new(); |
578 |
| 573 gtk_widget_realize(d); |
579 d = gtk_dialog_new(); |
| 574 aol_icon(d->window); |
580 gtk_widget_realize(d); |
| 575 |
581 aol_icon(d->window); |
| 576 |
582 |
| 577 label = gtk_label_new(buf2); |
583 |
| 578 gtk_widget_show(label); |
584 label = gtk_label_new(buf2); |
| 579 yesbtn = picture_button(d, _("Yes"), ok_xpm); |
585 gtk_widget_show(label); |
| 580 nobtn = picture_button(d, _("No"), cancel_xpm); |
586 yesbtn = picture_button(d, _("Yes"), ok_xpm); |
| 581 gtk_widget_show(nobtn); |
587 nobtn = picture_button(d, _("No"), cancel_xpm); |
| 582 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), |
588 gtk_widget_show(nobtn); |
| 583 label, FALSE, FALSE, 5); |
589 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), label, FALSE, FALSE, 5); |
| 584 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), |
590 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), yesbtn, FALSE, FALSE, 5); |
| 585 yesbtn, FALSE, FALSE, 5); |
591 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), nobtn, FALSE, FALSE, 5); |
| 586 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), |
|
| 587 nobtn, FALSE, FALSE, 5); |
|
| 588 |
592 |
| 589 gtk_object_set_user_data(GTK_OBJECT(GTK_DIALOG(d)->vbox), g); |
593 gtk_object_set_user_data(GTK_OBJECT(GTK_DIALOG(d)->vbox), g); |
| 590 if (g->protocol == PROTO_TOC) { |
594 if (g->protocol == PROTO_TOC) { |
| 591 gtk_object_set_user_data(GTK_OBJECT(d), (void *)id); |
595 gtk_object_set_user_data(GTK_OBJECT(d), (void *)id); |
| 592 gtk_object_set_user_data(GTK_OBJECT(GTK_DIALOG(d)->vbox), g); |
596 gtk_object_set_user_data(GTK_OBJECT(GTK_DIALOG(d)->vbox), g); |
| 593 } else if (g->protocol == PROTO_OSCAR) { |
597 } else if (g->protocol == PROTO_OSCAR) { |
| 594 gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name)); |
598 gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name)); |
| 595 gtk_object_set_user_data(GTK_OBJECT(yesbtn), (void *)id); |
599 gtk_object_set_user_data(GTK_OBJECT(yesbtn), (void *)id); |
| 596 } |
600 } |
| 597 |
601 |
| 598 |
602 |
| 599 gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite"); |
603 gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite"); |
| 600 gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d); |
604 gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d); |
| 601 gtk_signal_connect(GTK_OBJECT(yesbtn), "clicked", GTK_SIGNAL_FUNC(chat_invite_callback), d); |
605 gtk_signal_connect(GTK_OBJECT(yesbtn), "clicked", GTK_SIGNAL_FUNC(chat_invite_callback), d); |
| 602 |
606 |
| 603 |
607 |
| 604 gtk_widget_show(d); |
608 gtk_widget_show(d); |
| 605 } |
609 } |
| 606 |
610 |
| 607 void serv_got_joined_chat(struct gaim_connection *gc, int id, char *name) |
611 void serv_got_joined_chat(struct gaim_connection *gc, int id, char *name) |
| 608 { |
612 { |
| 609 struct conversation *b; |
613 struct conversation *b; |
| 610 |
614 |
| 611 plugin_event(event_chat_join, gc, name, 0, 0); |
615 plugin_event(event_chat_join, gc, name, 0, 0); |
| 612 |
616 |
| 613 b = (struct conversation *)g_new0(struct conversation, 1); |
617 b = (struct conversation *)g_new0(struct conversation, 1); |
| 614 gc->buddy_chats = g_slist_append(gc->buddy_chats, b); |
618 gc->buddy_chats = g_slist_append(gc->buddy_chats, b); |
| 615 |
619 |
| 616 b->is_chat = TRUE; |
620 b->is_chat = TRUE; |
| 617 b->ignored = NULL; |
621 b->ignored = NULL; |
| 618 b->in_room = NULL; |
622 b->in_room = NULL; |
| 619 b->id = id; |
623 b->id = id; |
| 620 b->gc = gc; |
624 b->gc = gc; |
| 621 g_snprintf(b->name, 80, "%s", name); |
625 g_snprintf(b->name, 80, "%s", name); |
| 622 |
626 |
| 623 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(b->name)) { |
627 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(b->name)) { |
| 624 FILE *fd; |
628 FILE *fd; |
| 625 char *filename; |
629 char *filename; |
| 626 |
630 |
| 627 filename = (char *)malloc(100); |
631 filename = (char *)malloc(100); |
| 628 g_snprintf(filename, 100, "%s.chat", b->name); |
632 g_snprintf(filename, 100, "%s.chat", b->name); |
| 629 |
633 |
| 630 fd = open_log_file(filename); |
634 fd = open_log_file(filename); |
| 631 if (!(general_options & OPT_GEN_STRIP_HTML)) |
635 if (!(general_options & OPT_GEN_STRIP_HTML)) |
| 632 fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date()); |
636 fprintf(fd, |
| |
637 "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", |
| |
638 full_date()); |
| 633 else |
639 else |
| 634 fprintf(fd, "---- New Conversation @ %s ----\n", full_date()); |
640 fprintf(fd, "---- New Conversation @ %s ----\n", full_date()); |
| 635 |
641 |
| 636 fclose(fd); |
642 fclose(fd); |
| 637 free(filename); |
643 free(filename); |
| 638 } |
644 } |
| 639 |
645 |
| 640 show_new_buddy_chat(b); |
646 show_new_buddy_chat(b); |
| 641 } |
647 } |
| 642 |
648 |
| 643 void serv_got_chat_left(struct gaim_connection *g, int id) |
649 void serv_got_chat_left(struct gaim_connection *g, int id) |
| 644 { |
650 { |
| 645 GSList *bcs = g->buddy_chats; |
651 GSList *bcs = g->buddy_chats; |
| 646 struct conversation *b = NULL; |
652 struct conversation *b = NULL; |
| 647 |
653 |
| 648 |
654 |
| 649 while(bcs) { |
655 while (bcs) { |
| 650 b = (struct conversation *)bcs->data; |
656 b = (struct conversation *)bcs->data; |
| 651 if (id == b->id) { |
657 if (id == b->id) { |
| 652 break; |
658 break; |
| 653 } |
659 } |
| 654 b = NULL; |
660 b = NULL; |
| 655 bcs = bcs->next; |
661 bcs = bcs->next; |
| 656 } |
662 } |
| 657 |
663 |
| 658 if (!b) |
664 if (!b) |
| 659 return; |
665 return; |
| 660 |
666 |
| 661 plugin_event(event_chat_leave, g, b->name, 0, 0); |
667 plugin_event(event_chat_leave, g, b->name, 0, 0); |
| 662 |
668 |
| 663 debug_printf("Leaving room %s.\n", b->name); |
669 debug_printf("Leaving room %s.\n", b->name); |
| 664 |
670 |
| 665 g->buddy_chats = g_slist_remove(g->buddy_chats, b); |
671 g->buddy_chats = g_slist_remove(g->buddy_chats, b); |
| 666 |
672 |
| 667 while (b->in_room) { |
673 while (b->in_room) { |
| 668 char *tmp = b->in_room->data; |
674 char *tmp = b->in_room->data; |
| 669 b->in_room = g_list_remove(b->in_room, tmp); |
675 b->in_room = g_list_remove(b->in_room, tmp); |
| 670 g_free(tmp); |
676 g_free(tmp); |
| 671 } |
677 } |
| 672 |
678 |
| 673 g_free(b); |
679 g_free(b); |
| 674 } |
680 } |
| 675 |
681 |
| 676 void serv_got_chat_in(struct gaim_connection *g, int id, char *who, int whisper, char *message) |
682 void serv_got_chat_in(struct gaim_connection *g, int id, char *who, int whisper, char *message) |
| 677 { |
683 { |
| 678 int w; |
684 int w; |
| 679 GSList *bcs = g->buddy_chats; |
685 GSList *bcs = g->buddy_chats; |
| 680 struct conversation *b = NULL; |
686 struct conversation *b = NULL; |
| 681 |
687 |
| 682 while(bcs) { |
688 while (bcs) { |
| 683 b = (struct conversation *)bcs->data; |
689 b = (struct conversation *)bcs->data; |
| 684 if (id == b->id) |
690 if (id == b->id) |
| 685 break; |
691 break; |
| 686 bcs = bcs->next; |
692 bcs = bcs->next; |
| 687 b = NULL; |
693 b = NULL; |
| 688 |
694 |
| 689 } |
695 } |
| 690 if (!b) |
696 if (!b) |
| 691 return; |
697 return; |
| 692 |
698 |
| 693 if (plugin_event(event_chat_recv, g, b->name, who, message)) |
699 if (plugin_event(event_chat_recv, g, b->name, who, message)) |
| 694 return; |
700 return; |
| 695 |
701 |
| 696 if (whisper) |
702 if (whisper) |
| 697 w = WFLAG_WHISPER; |
703 w = WFLAG_WHISPER; |
| 698 else |
704 else |
| 699 w = 0; |
705 w = 0; |
| 700 |
706 |
| 701 chat_write(b, who, w, message); |
707 chat_write(b, who, w, message); |
| 702 } |
708 } |
| 703 |
709 |
| 704 void send_keepalive(gpointer d) { |
710 void send_keepalive(gpointer d) |
| |
711 { |
| 705 struct gaim_connection *gc = (struct gaim_connection *)d; |
712 struct gaim_connection *gc = (struct gaim_connection *)d; |
| 706 if (gc->prpl && gc->prpl->keepalive) |
713 if (gc->prpl && gc->prpl->keepalive) |
| 707 (*gc->prpl->keepalive)(gc); |
714 (*gc->prpl->keepalive)(gc); |
| 708 } |
715 } |
| 709 |
716 |
| 710 void update_keepalive(struct gaim_connection *gc, gboolean on) { |
717 void update_keepalive(struct gaim_connection *gc, gboolean on) |
| |
718 { |
| 711 if (on && !gc->keepalive && blist) { |
719 if (on && !gc->keepalive && blist) { |
| 712 debug_printf("allowing NOP\n"); |
720 debug_printf("allowing NOP\n"); |
| 713 gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc); |
721 gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc); |
| 714 } else if (!on && gc->keepalive > 0) { |
722 } else if (!on && gc->keepalive > 0) { |
| 715 debug_printf("removing NOP\n"); |
723 debug_printf("removing NOP\n"); |