comparison src/protocols/oscar/oscar.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 e807abdcee83
children c6973001473d
comparison
equal deleted inserted replaced
5233:202105dbed8f 5234:890b29f00b68
2258 "rendezvous with %s, status is %hu\n", 2258 "rendezvous with %s, status is %hu\n",
2259 userinfo->sn, args->status); 2259 userinfo->sn, args->status);
2260 2260
2261 if (args->reqclass & AIM_CAPS_CHAT) { 2261 if (args->reqclass & AIM_CAPS_CHAT) {
2262 char *name; 2262 char *name;
2263 int *exch; 2263 GHashTable *components;
2264 GList *m = NULL; 2264
2265
2266 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) 2265 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg)
2267 return 1; 2266 return 1;
2267 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
2268 g_free);
2268 name = extract_name(args->info.chat.roominfo.name); 2269 name = extract_name(args->info.chat.roominfo.name);
2269 exch = g_new0(int, 1); 2270 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name));
2270 m = g_list_append(m, g_strdup(name ? name : args->info.chat.roominfo.name)); 2271 g_hash_table_replace(components, g_strdup("exchange"), g_strdup_printf("%d", args->info.chat.roominfo.exchange));
2271 *exch = args->info.chat.roominfo.exchange;
2272 m = g_list_append(m, exch);
2273 serv_got_chat_invite(gc, 2272 serv_got_chat_invite(gc,
2274 name ? name : args->info.chat.roominfo.name, 2273 name ? name : args->info.chat.roominfo.name,
2275 userinfo->sn, 2274 userinfo->sn,
2276 (char *)args->msg, 2275 (char *)args->msg,
2277 m); 2276 components);
2278 if (name) 2277 if (name)
2279 g_free(name); 2278 g_free(name);
2280 } else if (args->reqclass & AIM_CAPS_SENDFILE) { 2279 } else if (args->reqclass & AIM_CAPS_SENDFILE) {
2281 /* BBB */ 2280 /* BBB */
2282 if (args->status == AIM_RENDEZVOUS_PROPOSE) { 2281 if (args->status == AIM_RENDEZVOUS_PROPOSE) {
4829 GSList *cur; 4828 GSList *cur;
4830 4829
4831 /* Buddies */ 4830 /* Buddies */
4832 if ((blist = gaim_get_blist())) 4831 if ((blist = gaim_get_blist()))
4833 for (gnode = blist->root; gnode; gnode = gnode->next) { 4832 for (gnode = blist->root; gnode; gnode = gnode->next) {
4833 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
4834 continue;
4834 group = (struct group *)gnode; 4835 group = (struct group *)gnode;
4835 for (bnode = gnode->child; bnode; bnode = bnode->next) { 4836 for (bnode = gnode->child; bnode; bnode = bnode->next) {
4837 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
4838 continue;
4836 buddy = (struct buddy *)bnode; 4839 buddy = (struct buddy *)bnode;
4837 if (buddy->account == gc->account) { 4840 if (buddy->account == gc->account) {
4838 gchar *servernick = gaim_buddy_get_setting(buddy, "servernick"); 4841 gchar *servernick = gaim_buddy_get_setting(buddy, "servernick");
4839 if (servernick) { 4842 if (servernick) {
4840 serv_got_alias(gc, buddy->name, servernick); 4843 serv_got_alias(gc, buddy->name, servernick);
5096 GList *m = NULL; 5099 GList *m = NULL;
5097 struct proto_chat_entry *pce; 5100 struct proto_chat_entry *pce;
5098 5101
5099 pce = g_new0(struct proto_chat_entry, 1); 5102 pce = g_new0(struct proto_chat_entry, 1);
5100 pce->label = _("Join what group:"); 5103 pce->label = _("Join what group:");
5104 pce->identifier = "room";
5101 m = g_list_append(m, pce); 5105 m = g_list_append(m, pce);
5102 5106
5103 pce = g_new0(struct proto_chat_entry, 1); 5107 pce = g_new0(struct proto_chat_entry, 1);
5104 pce->label = _("Exchange:"); 5108 pce->label = _("Exchange:");
5109 pce->identifier = "exchange";
5105 pce->is_int = TRUE; 5110 pce->is_int = TRUE;
5106 pce->min = 4; 5111 pce->min = 4;
5107 pce->max = 20; 5112 pce->max = 20;
5108 m = g_list_append(m, pce); 5113 m = g_list_append(m, pce);
5109 5114
5110 return m; 5115 return m;
5111 } 5116 }
5112 5117
5113 static void oscar_join_chat(struct gaim_connection *g, GList *data) { 5118 static void oscar_join_chat(struct gaim_connection *g, GHashTable *data) {
5114 struct oscar_data *od = (struct oscar_data *)g->proto_data; 5119 struct oscar_data *od = (struct oscar_data *)g->proto_data;
5115 aim_conn_t *cur; 5120 aim_conn_t *cur;
5116 char *name; 5121 char *name, *exchange;
5117 int *exchange; 5122
5118 5123 name = g_hash_table_lookup(data, "room");
5119 if (!data || !data->next) 5124 exchange = g_hash_table_lookup(data, "exchange");
5120 return;
5121
5122 name = data->data;
5123 exchange = data->next->data;
5124 5125
5125 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5126 gaim_debug(GAIM_DEBUG_INFO, "oscar",
5126 "Attempting to join chat room %s.\n", name); 5127 "Attempting to join chat room %s.\n", name);
5127 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { 5128 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
5128 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5129 gaim_debug(GAIM_DEBUG_INFO, "oscar",
5129 "chatnav exists, creating room\n"); 5130 "chatnav exists, creating room\n");
5130 aim_chatnav_createroom(od->sess, cur, name, *exchange); 5131 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange));
5131 } else { 5132 } else {
5132 /* this gets tricky */ 5133 /* this gets tricky */
5133 struct create_room *cr = g_new0(struct create_room, 1); 5134 struct create_room *cr = g_new0(struct create_room, 1);
5134 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5135 gaim_debug(GAIM_DEBUG_INFO, "oscar",
5135 "chatnav does not exist, opening chatnav\n"); 5136 "chatnav does not exist, opening chatnav\n");
5136 cr->exchange = *exchange; 5137 cr->exchange = atoi(exchange);
5137 cr->name = g_strdup(name); 5138 cr->name = g_strdup(name);
5138 od->create_rooms = g_slist_append(od->create_rooms, cr); 5139 od->create_rooms = g_slist_append(od->create_rooms, cr);
5139 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); 5140 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV);
5140 } 5141 }
5141 } 5142 }