Exemplo n.º 1
0
void yahoo_c_join(PurpleConnection *gc, GHashTable *data)
{
	YahooData *yd;
	char *room, *topic, *type;
	PurpleConversation *c;

	yd = (YahooData *) gc->proto_data;
	if (!yd)
		return;

	room = g_hash_table_lookup(data, "room");
	if (!room)
		return;

	topic = g_hash_table_lookup(data, "topic");
	if (!topic)
		topic = "";

	if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) {
		int id;
		const char *members = g_hash_table_lookup(data, "members");
		id = yd->conf_id++;
		c = serv_got_joined_chat(gc, id, room);
		yd->confs = g_slist_prepend(yd->confs, c);
		purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), purple_connection_get_display_name(gc), topic);
		yahoo_conf_join(yd, c, purple_connection_get_display_name(gc), room, topic, members);
		return;
	} else {
		const char *id;
		/*if (yd->in_chat)
			yahoo_chat_leave(gc, room,
					purple_connection_get_display_name(gc),
					FALSE);*/

		id = g_hash_table_lookup(data, "id");

		if (!yd->chat_online) {
			yahoo_chat_online(gc);
			g_free(yd->pending_chat_room);
			yd->pending_chat_room = g_strdup(room);
			g_free(yd->pending_chat_id);
			yd->pending_chat_id = g_strdup(id);
			g_free(yd->pending_chat_topic);
			yd->pending_chat_topic = g_strdup(topic);
			g_free(yd->pending_chat_goto);
			yd->pending_chat_goto = NULL;
		} else {
			yahoo_chat_join(gc, purple_connection_get_display_name(gc), room, topic, id);
		}
		return;
	}
}
Exemplo n.º 2
0
void yahoo_c_join(GaimConnection *gc, GHashTable *data)
{
	struct yahoo_data *yd;
	char *room, *topic, *members, *type;
	int id;
	GaimConversation *c;

	yd = (struct yahoo_data *) gc->proto_data;
	if (!yd)
		return;

	room = g_hash_table_lookup(data, "room");
	if (!room)
		return;

	topic = g_hash_table_lookup(data, "topic");
	if (!topic)
		topic = "";

	members = g_hash_table_lookup(data, "members");

	if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) {
		id = yd->conf_id++;
		c = serv_got_joined_chat(gc, id, room);
		yd->confs = g_slist_prepend(yd->confs, c);
		gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), gaim_connection_get_display_name(gc), topic);
		yahoo_conf_join(yd, c, gaim_connection_get_display_name(gc), room, topic, members);
		return;
	} else {
		if (yd->in_chat)
			yahoo_chat_leave(gc, room,
					gaim_connection_get_display_name(gc),
					FALSE);
		if (!yd->chat_online)
			yahoo_chat_online(gc);
		yahoo_chat_join(gc, gaim_connection_get_display_name(gc), room, topic);
		return;
	}
}