comparison src/toc.c @ 1182:bab9f3dc07f8

[gaim-migrate @ 1192] i hope this doesn't break things. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 01 Dec 2000 14:57:56 +0000
parents 3063e6743913
children 66a70fbb2b09
comparison
equal deleted inserted replaced
1181:2e0e157b49a0 1182:bab9f3dc07f8
45 #include "pixmaps/aol_icon.xpm" 45 #include "pixmaps/aol_icon.xpm"
46 #include "pixmaps/away_icon.xpm" 46 #include "pixmaps/away_icon.xpm"
47 #include "pixmaps/dt_icon.xpm" 47 #include "pixmaps/dt_icon.xpm"
48 #include "pixmaps/free_icon.xpm" 48 #include "pixmaps/free_icon.xpm"
49 49
50 #define REVISION "gaim:$Revision: 1163 $" 50 #define REVISION "gaim:$Revision: 1192 $"
51 51
52 #define TYPE_SIGNON 1 52 #define TYPE_SIGNON 1
53 #define TYPE_DATA 2 53 #define TYPE_DATA 2
54 #define TYPE_ERROR 3 54 #define TYPE_ERROR 3
55 #define TYPE_SIGNOFF 4 55 #define TYPE_SIGNOFF 4
475 who = strtok(NULL, ":"); 475 who = strtok(NULL, ":");
476 message = strtok(NULL, ":"); 476 message = strtok(NULL, ":");
477 477
478 serv_got_chat_invite(gc, name, id, who, message); 478 serv_got_chat_invite(gc, name, id, who, message);
479 } else if (!strcasecmp(c, "CHAT_LEFT")) { 479 } else if (!strcasecmp(c, "CHAT_LEFT")) {
480 GSList *bcs = gc->buddy_chats;
481 struct conversation *b = NULL;
480 int id; 482 int id;
481 483
482 sscanf(strtok(NULL, ":"), "%d", &id); 484 sscanf(strtok(NULL, ":"), "%d", &id);
483 485
484 serv_got_chat_left(gc, id); 486 while (bcs) {
487 b = (struct conversation *)bcs->data;
488 if (id == b->id)
489 break;
490 b = NULL;
491 bcs = bcs->next;
492 }
493
494 if (!b)
495 return;
496
497 if (b->window) {
498 char error_buf[BUF_LONG];
499 b->gc = NULL;
500 g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected"
501 " from chat room %s."), b->name);
502 } else
503 serv_got_chat_left(gc, id);
485 } else if (!strcasecmp(c, "GOTO_URL")) { 504 } else if (!strcasecmp(c, "GOTO_URL")) {
486 char *name, *url, tmp[256]; 505 char *name, *url, tmp[256];
487 506
488 name = strtok(NULL, ":"); 507 name = strtok(NULL, ":");
489 url = strtok(NULL, ":"); 508 url = strtok(NULL, ":");
879 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); 898 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
880 sflap_send(g, buf, -1, TYPE_DATA); 899 sflap_send(g, buf, -1, TYPE_DATA);
881 } 900 }
882 901
883 static void toc_chat_leave(struct gaim_connection *g, int id) { 902 static void toc_chat_leave(struct gaim_connection *g, int id) {
903 GSList *bcs = g->buddy_chats;
904 struct conversation *b = NULL;
884 char buf[256]; 905 char buf[256];
885 g_snprintf(buf, 255, "toc_chat_leave %d", id); 906
886 sflap_send(g, buf, -1, TYPE_DATA); 907 while (bcs) {
908 b = (struct conversation *)bcs->data;
909 if (id == b->id)
910 break;
911 b = NULL;
912 bcs = bcs->next;
913 }
914
915 if (!b)
916 return; /* can this happen? */
917
918 if (!b->gc) /* TOC already kicked us out of this room */
919 serv_got_chat_left(g, id);
920 else {
921 g_snprintf(buf, 255, "toc_chat_leave %d", id);
922 sflap_send(g, buf, -1, TYPE_DATA);
923 }
887 } 924 }
888 925
889 static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message) { 926 static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message) {
890 char buf2[MSG_LEN]; 927 char buf2[MSG_LEN];
891 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); 928 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message);