comparison src/protocols/toc/toc.c @ 5234:890b29f00b68

[gaim-migrate @ 5604] Chats in the buddy list! You can now put chat rooms in your buddy list, and double-click them to join them, instead of having to do all that typing. I'm eventually gonna add auto-join support, so that ugly hack involving pouncing can go away. Someone should make some new artwork so we don't have 2 + icons next to each other in the menus. This also has some fixes to let gaim compile again, after the renaming of the buddy list files. This also fixes the problem with offline buddies not showing up in the list sometimes for accounts that didn't log in at startup. This probably fixes other stuff, but I can't remember any of it off the top of my head. I'm going to stop typing and let people play with this now. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 26 Apr 2003 20:30:43 +0000
parents fefad67de2c7
children ad445074d239
comparison
equal deleted inserted replaced
5233:202105dbed8f 5234:890b29f00b68
816 else 816 else
817 while ((buddy = strtok(NULL, ":")) != NULL) 817 while ((buddy = strtok(NULL, ":")) != NULL)
818 gaim_chat_remove_user(chat, buddy, NULL); 818 gaim_chat_remove_user(chat, buddy, NULL);
819 } else if (!g_ascii_strcasecmp(c, "CHAT_INVITE")) { 819 } else if (!g_ascii_strcasecmp(c, "CHAT_INVITE")) {
820 char *name, *who, *message; 820 char *name, *who, *message;
821 int *id = g_new0(int, 1); 821 int id;
822 GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal,
823 g_free, g_free);
822 824
823 name = strtok(NULL, ":"); 825 name = strtok(NULL, ":");
824 sscanf(strtok(NULL, ":"), "%d", id); 826 sscanf(strtok(NULL, ":"), "%d", &id);
825 who = strtok(NULL, ":"); 827 who = strtok(NULL, ":");
826 message = strtok(NULL, ":"); 828 message = strtok(NULL, ":");
827 829
828 serv_got_chat_invite(gc, name, who, message, g_list_append(NULL, id)); 830 g_hash_table_replace(components, g_strdup("id"), g_strdup_printf("%d", id));
831
832 serv_got_chat_invite(gc, name, who, message, components);
829 } else if (!g_ascii_strcasecmp(c, "CHAT_LEFT")) { 833 } else if (!g_ascii_strcasecmp(c, "CHAT_LEFT")) {
830 GSList *bcs = gc->buddy_chats; 834 GSList *bcs = gc->buddy_chats;
831 struct gaim_conversation *b = NULL; 835 struct gaim_conversation *b = NULL;
832 int id; 836 int id;
833 837
1183 GList *m = NULL; 1187 GList *m = NULL;
1184 struct proto_chat_entry *pce; 1188 struct proto_chat_entry *pce;
1185 1189
1186 pce = g_new0(struct proto_chat_entry, 1); 1190 pce = g_new0(struct proto_chat_entry, 1);
1187 pce->label = _("Join what group:"); 1191 pce->label = _("Join what group:");
1192 pce->identifier = "room";
1188 m = g_list_append(m, pce); 1193 m = g_list_append(m, pce);
1189 1194
1190 pce = g_new0(struct proto_chat_entry, 1); 1195 pce = g_new0(struct proto_chat_entry, 1);
1191 pce->label = _("Exchange:"); 1196 pce->label = _("Exchange:");
1197 pce->identifier = "exchange";
1192 pce->is_int = TRUE; 1198 pce->is_int = TRUE;
1193 pce->min = 4; 1199 pce->min = 4;
1194 pce->max = 20; 1200 pce->max = 20;
1195 m = g_list_append(m, pce); 1201 m = g_list_append(m, pce);
1196 1202
1197 return m; 1203 return m;
1198 } 1204 }
1199 1205
1200 static void toc_join_chat(struct gaim_connection *g, GList *data) 1206 static void toc_join_chat(struct gaim_connection *g, GHashTable *data)
1201 { 1207 {
1202 char buf[BUF_LONG]; 1208 char buf[BUF_LONG];
1203 int *exchange; 1209 char *name, *exchange;
1204 char *name; 1210 char *id;
1205 int *i; 1211
1206 1212 name = g_hash_table_lookup(data, "room");
1207 if (!data) 1213 exchange = g_hash_table_lookup(data, "exchange");
1208 return; 1214 id = g_hash_table_lookup(data, "id");
1209 1215
1210 if (!data->next) { 1216 if (id) {
1211 i = data->data; 1217 g_snprintf(buf, 255, "toc_chat_accept %d", atoi(id));
1212 g_snprintf(buf, 255, "toc_chat_accept %d", *i);
1213 } else { 1218 } else {
1214 name = data->data; 1219 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", atoi(exchange), name);
1215 exchange = data->next->data;
1216 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", *exchange, name);
1217 } 1220 }
1218 1221
1219 sflap_send(g, buf, -1, TYPE_DATA); 1222 sflap_send(g, buf, -1, TYPE_DATA);
1220 } 1223 }
1221 1224