Ejemplo n.º 1
0
static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id)
{
	YahooData *yd = gc->proto_data;
	struct yahoo_packet *pkt;
	char *room2;
	gboolean utf8 = TRUE;

	if (yd->wm) {
		g_return_if_fail(yd->ycht != NULL);
		ycht_chat_join(yd->ycht, room);
		return;
	}

	/* apparently room names are always utf8, or else always not utf8,
	 * so we don't have to actually pass the flag in the packet. Or something. */
	room2 = yahoo_string_encode(gc, room, &utf8);

	pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, yd->session_id);
	yahoo_packet_hash(pkt, "ssss",
						1, purple_connection_get_display_name(gc),
						104, room2,
						62, "2",
						129, id ? id : "0");
	yahoo_packet_send_and_free(pkt, yd);
	g_free(room2);
}
Ejemplo n.º 2
0
/************************************************************************************
 * Functions to process various kinds of packets.
 ************************************************************************************/
static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt)
{
	PurpleConnection *gc = ycht->gc;
	YahooData *yd = purple_connection_get_protocol_data(gc);

	if (ycht->logged_in)
		return;

	yd->chat_online = TRUE;
	ycht->logged_in = TRUE;

	if (ycht->room)
		ycht_chat_join(ycht, ycht->room);
}