pidgin.vv.yahoo.voice: c50b2269: Use a separate handle for YAHOOREF messa...

maiku at pidgin.im maiku at pidgin.im
Sat Aug 29 07:55:44 EDT 2009


-----------------------------------------------------------------
Revision: c50b2269a9ca465d32a3642c07cef152a97c5e23
Ancestor: ee6e5142fd1d490fe5280d337a0d770b68d591d1
Author: maiku at pidgin.im
Date: 2009-08-29T10:44:40
Branch: im.pidgin.pidgin.vv.yahoo.voice
URL: http://d.pidgin.im/viewmtn/revision/info/c50b2269a9ca465d32a3642c07cef152a97c5e23

Modified files:
        libpurple/protocols/yahoo/yahoo_sip.c

ChangeLog: 

Use a separate handle for YAHOOREF messages. Using a single handle was
causing it to block other messages and shutdown until its 30 second
timeout expired.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo_sip.c	c1540db6c6c66bcf385cd1093f811eac76f755f3
+++ libpurple/protocols/yahoo/yahoo_sip.c	35b606c2073dc039791dce1860fe40f3e9329273
@@ -42,6 +42,8 @@ struct _YahooSip {
 	su_root_t *root;
 	nua_t *nua;
 	nua_handle_t *nh;
+	nua_handle_t *yahooref_nh;
+	guint yahooref_timeout_handle;
 	gboolean shutdown;
 };
 
@@ -287,10 +289,23 @@ event_callback(nua_event_t event, int st
 		g_free(auth);
 		g_free(cookie);
 	} else if (event == nua_r_register && status == 200) {
+		PurpleAccount *account = magic;
+		PurpleConnection *pc = purple_account_get_connection(account);
+		YahooData *yd = pc->proto_data;
+		YahooSip *ysip = yd->ysip;
+		gchar *sip_str;
 		nua_subscribe(nh, 
 				SIPTAG_EVENT_STR("billing"),
 				TAG_END());
-		purple_timeout_add_seconds(60, send_yahooref, nh);
+		sip_str = g_strdup_printf("sip:%s at 68.142.233.179:443;transport=tcp",
+				purple_url_encode(purple_account_get_username(account)));
+		ysip->yahooref_nh = nua_handle(ysip->nua, NULL,
+				SIPTAG_TO_STR(sip_str),
+				TAG_END());
+		g_free(sip_str);
+		ysip->yahooref_timeout_handle =
+				purple_timeout_add_seconds(60,
+				send_yahooref, ysip->yahooref_nh);
 	} else if (event == nua_r_unregister && status == 200) {
 		nua_shutdown(nua);
 	} else if (event == nua_r_shutdown && status >= 200) {
@@ -485,6 +500,12 @@ yahoo_sip_uninit(PurpleAccount *account)
 	YahooData *yd = purple_connection_get_protocol_data(pc);
 	YahooSip *ysip = yd->ysip;
 
+	if (ysip->yahooref_timeout_handle)
+		purple_timeout_remove(ysip->yahooref_timeout_handle);
+
+	if (ysip->yahooref_nh)
+		nua_handle_unref(ysip->yahooref_nh);
+
 	if (nua_handle_has_registrations(ysip->nh) == 1)
 		nua_unregister(ysip->nh, TAG_NULL());
 	else


More information about the Commits mailing list