comparison src/protocols/toc/toc.c @ 7118:bf630f7dfdcd

[gaim-migrate @ 7685] Here's a commit that I think will make faceprint happy. GaimWindow -> GaimConvWindow, GaimIm -> GaimConvIm, GaimChat -> GaimConvChat, GaimBlistChat -> GaimChat, and updated the API functions as well. Plugin authors are going to hunt me down and murder me. I can feel it.. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 02 Oct 2003 02:54:07 +0000
parents 943085b0ff8b
children 1930e3d00ecd
comparison
equal deleted inserted replaced
7117:943085b0ff8b 7118:bf630f7dfdcd
733 message = away; 733 message = away;
734 while (*message && (*message != ':')) 734 while (*message && (*message != ':'))
735 message++; 735 message++;
736 message++; 736 message++;
737 737
738 a = (away && (*away == 'T')) ? GAIM_IM_AUTO_RESP : 0; 738 a = (away && (*away == 'T')) ? GAIM_CONV_IM_AUTO_RESP : 0;
739 739
740 serv_got_im(gc, c, message, a, time(NULL)); 740 serv_got_im(gc, c, message, a, time(NULL));
741 } else if (!g_ascii_strcasecmp(c, "UPDATE_BUDDY")) { 741 } else if (!g_ascii_strcasecmp(c, "UPDATE_BUDDY")) {
742 char *l, *uc, *tmp; 742 char *l, *uc, *tmp;
743 int logged, evil, idle, type = 0; 743 int logged, evil, idle, type = 0;
821 } else if (!g_ascii_strcasecmp(c, "CHAT_UPDATE_BUDDY")) { 821 } else if (!g_ascii_strcasecmp(c, "CHAT_UPDATE_BUDDY")) {
822 int id; 822 int id;
823 char *in, *buddy; 823 char *in, *buddy;
824 GSList *bcs = gc->buddy_chats; 824 GSList *bcs = gc->buddy_chats;
825 GaimConversation *b = NULL; 825 GaimConversation *b = NULL;
826 GaimChat *chat; 826 GaimConvChat *chat;
827 827
828 sscanf(strtok(NULL, ":"), "%d", &id); 828 sscanf(strtok(NULL, ":"), "%d", &id);
829 in = strtok(NULL, ":"); 829 in = strtok(NULL, ":");
830 830
831 chat = GAIM_CHAT(b); 831 chat = GAIM_CONV_CHAT(b);
832 832
833 while (bcs) { 833 while (bcs) {
834 b = (GaimConversation *)bcs->data; 834 b = (GaimConversation *)bcs->data;
835 if (id == gaim_chat_get_id(chat)) 835 if (id == gaim_conv_chat_get_id(chat))
836 break; 836 break;
837 bcs = bcs->next; 837 bcs = bcs->next;
838 b = NULL; 838 b = NULL;
839 } 839 }
840 840
841 if (!b) 841 if (!b)
842 return; 842 return;
843 843
844 if (in && (*in == 'T')) 844 if (in && (*in == 'T'))
845 while ((buddy = strtok(NULL, ":")) != NULL) 845 while ((buddy = strtok(NULL, ":")) != NULL)
846 gaim_chat_add_user(chat, buddy, NULL); 846 gaim_conv_chat_add_user(chat, buddy, NULL);
847 else 847 else
848 while ((buddy = strtok(NULL, ":")) != NULL) 848 while ((buddy = strtok(NULL, ":")) != NULL)
849 gaim_chat_remove_user(chat, buddy, NULL); 849 gaim_conv_chat_remove_user(chat, buddy, NULL);
850 } else if (!g_ascii_strcasecmp(c, "CHAT_INVITE")) { 850 } else if (!g_ascii_strcasecmp(c, "CHAT_INVITE")) {
851 char *name, *who, *message; 851 char *name, *who, *message;
852 int id; 852 int id;
853 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, 853 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal,
854 g_free, g_free); 854 g_free, g_free);
868 868
869 sscanf(strtok(NULL, ":"), "%d", &id); 869 sscanf(strtok(NULL, ":"), "%d", &id);
870 870
871 while (bcs) { 871 while (bcs) {
872 b = (GaimConversation *)bcs->data; 872 b = (GaimConversation *)bcs->data;
873 if (id == gaim_chat_get_id(GAIM_CHAT(b))) 873 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)))
874 break; 874 break;
875 b = NULL; 875 b = NULL;
876 bcs = bcs->next; 876 bcs = bcs->next;
877 } 877 }
878 878
1054 gaim_debug(GAIM_DEBUG_ERROR, "toc", 1054 gaim_debug(GAIM_DEBUG_ERROR, "toc",
1055 "don't know what to do with %s\n", c); 1055 "don't know what to do with %s\n", c);
1056 } 1056 }
1057 } 1057 }
1058 1058
1059 static int toc_send_im(GaimConnection *gc, const char *name, const char *message, GaimImFlags flags) 1059 static int toc_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags flags)
1060 { 1060 {
1061 char *buf1, *buf2; 1061 char *buf1, *buf2;
1062 1062
1063 #if 1 1063 #if 1
1064 /* This is the old, non-i18n way */ 1064 /* This is the old, non-i18n way */
1066 if (strlen(buf1) + 52 > MSG_LEN) { 1066 if (strlen(buf1) + 52 > MSG_LEN) {
1067 g_free(buf1); 1067 g_free(buf1);
1068 return -E2BIG; 1068 return -E2BIG;
1069 } 1069 }
1070 buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", gaim_normalize(name), buf1, 1070 buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", gaim_normalize(name), buf1,
1071 ((flags & GAIM_IM_AUTO_RESP) ? " auto" : "")); 1071 ((flags & GAIM_CONV_IM_AUTO_RESP) ? " auto" : ""));
1072 g_free(buf1); 1072 g_free(buf1);
1073 #else 1073 #else
1074 /* This doesn't work yet. See the comments below for details */ 1074 /* This doesn't work yet. See the comments below for details */
1075 buf1 = gaim_strreplace(message, "\"", "\\\""); 1075 buf1 = gaim_strreplace(message, "\"", "\\\"");
1076 1076
1090 g_free(buf1); 1090 g_free(buf1);
1091 return -E2BIG; 1091 return -E2BIG;
1092 } 1092 }
1093 1093
1094 buf2 = g_strdup_printf("toc2_send_im_enc %s F U en \"%s\" %s", gaim_normalize(name), buf1, 1094 buf2 = g_strdup_printf("toc2_send_im_enc %s F U en \"%s\" %s", gaim_normalize(name), buf1,
1095 ((flags & GAIM_IM_AUTO_RESP) ? "auto" : "")); 1095 ((flags & GAIM_CONV_IM_AUTO_RESP) ? "auto" : ""));
1096 g_free(buf1); 1096 g_free(buf1);
1097 #endif 1097 #endif
1098 1098
1099 sflap_send(gc, buf2, -1, TYPE_DATA); 1099 sflap_send(gc, buf2, -1, TYPE_DATA);
1100 g_free(buf2); 1100 g_free(buf2);
1303 GaimConversation *b = NULL; 1303 GaimConversation *b = NULL;
1304 char buf[BUF_LEN * 2]; 1304 char buf[BUF_LEN * 2];
1305 1305
1306 while (bcs) { 1306 while (bcs) {
1307 b = (GaimConversation *)bcs->data; 1307 b = (GaimConversation *)bcs->data;
1308 if (id == gaim_chat_get_id(GAIM_CHAT(b))) 1308 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)))
1309 break; 1309 break;
1310 b = NULL; 1310 b = NULL;
1311 bcs = bcs->next; 1311 bcs = bcs->next;
1312 } 1312 }
1313 1313