changeset 23354:d33fcdbd6ebc

Add a can_receive_file function to the xmpp prpl so that we disable the menu item when it is not going to succeed. References #6078.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 13 Jun 2008 01:08:31 +0000
parents 77f43c248845
children bc3ecda40397 1be3301fa2a3
files libpurple/protocols/jabber/libxmpp.c libpurple/protocols/jabber/si.c libpurple/protocols/jabber/si.h
diffstat 3 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/libxmpp.c	Thu Jun 12 16:34:53 2008 +0000
+++ b/libpurple/protocols/jabber/libxmpp.c	Fri Jun 13 01:08:31 2008 +0000
@@ -76,9 +76,9 @@
 	jabber_roster_remove_buddy,		/* remove_buddy */
 	NULL,							/* remove_buddies */
 	NULL,							/* add_permit */
-	jabber_google_roster_add_deny,				/* add_deny */
+	jabber_google_roster_add_deny,	/* add_deny */
 	NULL,							/* rem_permit */
-	jabber_google_roster_rem_deny,				/* rem_deny */
+	jabber_google_roster_rem_deny,	/* rem_deny */
 	NULL,							/* set_permit_deny */
 	jabber_chat_join,				/* join_chat */
 	NULL,							/* reject_chat */
@@ -105,7 +105,7 @@
 	jabber_roomlist_get_list,		/* roomlist_get_list */
 	jabber_roomlist_cancel,			/* roomlist_cancel */
 	NULL,							/* roomlist_expand_category */
-	NULL,							/* can_receive_file */
+	jabber_si_xfer_can_receive_file,/* can_receive_file */
 	jabber_si_xfer_send,			/* send_file */
 	jabber_si_new_xfer,				/* new_xfer */
 	jabber_offline_message,			/* offline_message */
--- a/libpurple/protocols/jabber/si.c	Thu Jun 12 16:34:53 2008 +0000
+++ b/libpurple/protocols/jabber/si.c	Fri Jun 13 01:08:31 2008 +0000
@@ -1205,6 +1205,13 @@
 	return xfer;
 }
 
+gboolean jabber_si_xfer_can_receive_file(PurpleConnection *conn, const char *who)
+{
+	JabberStream *js = conn->proto_data;
+
+	return purple_find_buddy(conn->account, who) && jabber_buddy_find(js, who, FALSE);
+}
+	
 void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file)
 {
 	JabberStream *js;
@@ -1213,7 +1220,7 @@
 
 	js = gc->proto_data;
 
-	if(!purple_find_buddy(gc->account, who) || !jabber_buddy_find(js, who, FALSE))
+	if (!jabber_si_xfer_can_receive_file(gc, who))
 		return;
 
 	xfer = jabber_si_new_xfer(gc, who);
--- a/libpurple/protocols/jabber/si.h	Thu Jun 12 16:34:53 2008 +0000
+++ b/libpurple/protocols/jabber/si.h	Fri Jun 13 01:08:31 2008 +0000
@@ -28,6 +28,7 @@
 
 void jabber_bytestreams_parse(JabberStream *js, xmlnode *packet);
 void jabber_si_parse(JabberStream *js, xmlnode *packet);
+gboolean jabber_si_xfer_can_receive_file(PurpleConnection *conn, const char *who);
 PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who);
 void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file);