changeset 18856:5da32c4019ce

Show bonjour status messages in the buddy list.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 09 Aug 2007 22:10:44 +0000
parents 28a7c9dbbc2b
children bc9b78ba996a
files ChangeLog libpurple/protocols/bonjour/bonjour.c libpurple/protocols/bonjour/mdns_win32.c
diffstat 3 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Aug 09 18:58:07 2007 +0000
+++ b/ChangeLog	Thu Aug 09 22:10:44 2007 +0000
@@ -7,6 +7,7 @@
 	* Server-stored aliases for Yahoo. (John Moody)
 	* Fixed support for Yahoo! doodling.
 	* Bonjour plugin uses native Avahi instead of Howl
+	* Bonjour plugin supports Buddy Icons
 
 	Pidgin:
 	* Show current outgoing conversation formatting on the font label on
--- a/libpurple/protocols/bonjour/bonjour.c	Thu Aug 09 18:58:07 2007 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Thu Aug 09 22:10:44 2007 +0000
@@ -296,14 +296,22 @@
 static char *
 bonjour_status_text(PurpleBuddy *buddy)
 {
-	PurplePresence *presence;
+	const PurplePresence *presence;
+	const PurpleStatus *status;
+	const char *message;
+	gchar *ret = NULL;
 
 	presence = purple_buddy_get_presence(buddy);
+	status = purple_presence_get_active_status(presence);
 
-	if (purple_presence_is_online(presence) && !purple_presence_is_available(presence))
-		return g_strdup(_("Away"));
+	message = purple_status_get_attr_string(status, "message");
 
-	return NULL;
+	if (message != NULL) {
+		ret = g_markup_escape_text(message, -1);
+		purple_util_chrreplace(ret, '\n', ' ');
+	}
+
+	return ret;
 }
 
 static void
@@ -351,7 +359,7 @@
 	NULL,                                                    /* protocol_options */
 	{"png,gif,jpeg", 0, 0, 96, 96, 65535, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
 	bonjour_list_icon,                                       /* list_icon */
-	NULL,													 /* list_emblem */
+	NULL,                                                    /* list_emblem */
 	bonjour_status_text,                                     /* status_text */
 	bonjour_tooltip_text,                                    /* tooltip_text */
 	bonjour_status_types,                                    /* status_types */
@@ -421,11 +429,11 @@
 	PURPLE_PLUGIN_MAGIC,
 	PURPLE_MAJOR_VERSION,
 	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_PROTOCOL,                             /**< type           */
+	PURPLE_PLUGIN_PROTOCOL,                           /**< type           */
 	NULL,                                             /**< ui_requirement */
 	0,                                                /**< flags          */
 	NULL,                                             /**< dependencies   */
-	PURPLE_PRIORITY_DEFAULT,                            /**< priority       */
+	PURPLE_PRIORITY_DEFAULT,                          /**< priority       */
 
 	"prpl-bonjour",                                   /**< id             */
 	"Bonjour",                                        /**< name           */
@@ -435,10 +443,10 @@
 	                                                  /**  description    */
 	N_("Bonjour Protocol Plugin"),
 	NULL,                                             /**< author         */
-	PURPLE_WEBSITE,                                     /**< homepage       */
+	PURPLE_WEBSITE,                                   /**< homepage       */
 
 	NULL,                                             /**< load           */
-	plugin_unload,                                             /**< unload         */
+	plugin_unload,                                    /**< unload         */
 	NULL,                                             /**< destroy        */
 
 	NULL,                                             /**< ui_info        */
--- a/libpurple/protocols/bonjour/mdns_win32.c	Thu Aug 09 18:58:07 2007 +0000
+++ b/libpurple/protocols/bonjour/mdns_win32.c	Thu Aug 09 22:10:44 2007 +0000
@@ -72,7 +72,7 @@
 }
 
 static void DNSSD_API
-_mdns_text_record_query_callback(DNSServiceRef DNSServiceRef, DNSServiceFlags flags,
+_mdns_record_query_callback(DNSServiceRef DNSServiceRef, DNSServiceFlags flags,
 	uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname,
 	uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata,
 	uint32_t ttl, void *context)
@@ -125,7 +125,7 @@
 
 		if (kDNSServiceErr_NoError == DNSServiceQueryRecord(&idata->txt_query, kDNSServiceFlagsLongLivedQuery,
 				kDNSServiceInterfaceIndexAny, args->full_service_name, kDNSServiceType_TXT,
-				kDNSServiceClass_IN, _mdns_text_record_query_callback, buddy)) {
+				kDNSServiceClass_IN, _mdns_record_query_callback, buddy)) {
 
 			purple_debug_info("bonjour", "Found buddy %s at %s:%d\n", buddy->name, buddy->ip, buddy->port_p2pj);
 
@@ -441,7 +441,7 @@
 
 	DNSServiceConstructFullName(svc_name, buddy->name, ICHAT_SERVICE, "local");
 	if (kDNSServiceErr_NoError == DNSServiceQueryRecord(&idata->null_query, 0, kDNSServiceInterfaceIndexAny, svc_name,
-			kDNSServiceType_NULL, kDNSServiceClass_IN, _mdns_text_record_query_callback, buddy)) {
+			kDNSServiceType_NULL, kDNSServiceClass_IN, _mdns_record_query_callback, buddy)) {
 		idata->null_query_handler = purple_input_add(DNSServiceRefSockFD(idata->null_query),
 			PURPLE_INPUT_READ, _mdns_handle_event, idata->null_query);
 	}