pidgin: c35195de: Cannot send a file to a federated user o...
sadrul at pidgin.im
sadrul at pidgin.im
Sat Oct 31 23:10:40 EDT 2009
-----------------------------------------------------------------
Revision: c35195de7dcb61dcc6bd8b7d2ba229774dca25f3
Ancestor: 2a337fc21125a25203efca7d15ea3002fa8e35fb
Author: sadrul at pidgin.im
Date: 2009-11-01T02:56:44
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c35195de7dcb61dcc6bd8b7d2ba229774dca25f3
Modified files:
libpurple/protocols/yahoo/libyahoo.c
libpurple/protocols/yahoo/libymsg.c
libpurple/protocols/yahoo/libymsg.h
libpurple/protocols/yahoo/util.c
libpurple/protocols/yahoo/yahoo_filexfer.c
libpurple/protocols/yahoo/yahoo_filexfer.h
ChangeLog:
Cannot send a file to a federated user on yahoo.
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libyahoo.c e23838eefed8d9932940f9d15fe9506e9cc6b4b1
+++ libpurple/protocols/yahoo/libyahoo.c 706ac2c745153342476c250e96b5c3ee377f2ca3
@@ -249,7 +249,7 @@ static PurplePluginProtocolInfo prpl_inf
yahoo_roomlist_get_list,
yahoo_roomlist_cancel,
yahoo_roomlist_expand_category,
- NULL, /* can_receive_file */
+ yahoo_can_receive_file, /* can_receive_file */
yahoo_send_file,
yahoo_new_xfer,
yahoo_offline_message, /* offline_message */
============================================================
--- libpurple/protocols/yahoo/libymsg.c 6e4169045e1cd4c5a7944b48451478003df4ad73
+++ libpurple/protocols/yahoo/libymsg.c b320435577a0080a8e240b7deebd568e8a4a5a06
@@ -4367,17 +4367,7 @@ int yahoo_send_im(PurpleConnection *gc,
}
}
- if (who[3] == '/') {
- if (!g_ascii_strncasecmp(who, "msn/", 4)) {
- fed = YAHOO_FEDERATION_MSN;
- }
- else if (!g_ascii_strncasecmp(who, "ocs/", 4)) {
- fed = YAHOO_FEDERATION_OCS;
- }
- else if (!g_ascii_strncasecmp(who, "ibm/", 4)) {
- fed = YAHOO_FEDERATION_IBM;
- }
- }
+ fed = yahoo_get_federation_from_name(who);
if (who[0] == '+') {
/* we have an sms to be sent */
@@ -4509,17 +4499,7 @@ unsigned int yahoo_send_typing(PurpleCon
YahooFederation fed = YAHOO_FEDERATION_NONE;
struct yahoo_packet *pkt = NULL;
- if (who[3] == '/') {
- if (!g_ascii_strncasecmp(who, "msn/", 4)) {
- fed = YAHOO_FEDERATION_MSN;
- }
- else if (!g_ascii_strncasecmp(who, "ocs/", 4)) {
- fed = YAHOO_FEDERATION_OCS;
- }
- else if (!g_ascii_strncasecmp(who, "ibm/", 4)) {
- fed = YAHOO_FEDERATION_IBM;
- }
- }
+ fed = yahoo_get_federation_from_name(who);
/* Don't do anything if sms is being typed */
if( strncmp(who, "+", 1) == 0 )
@@ -4811,18 +4791,9 @@ void yahoo_add_buddy(PurpleConnection *g
return;
f = yahoo_friend_find(gc, bname);
- if (bname[3] == '/') {
+ fed = yahoo_get_federation_from_name(bname);
+ if (fed != YAHOO_FEDERATION_NONE)
fed_bname += 4;
- if (!g_ascii_strncasecmp(bname, "msn/", 4)) {
- fed = YAHOO_FEDERATION_MSN;
- }
- else if (!g_ascii_strncasecmp(bname, "ocs/", 4)) {
- fed = YAHOO_FEDERATION_OCS;
- }
- else if (!g_ascii_strncasecmp(bname, "ibm/", 4)) {
- fed = YAHOO_FEDERATION_IBM;
- }
- }
g = purple_buddy_get_group(buddy);
if (g)
@@ -4934,18 +4905,8 @@ void yahoo_add_deny(PurpleConnection *gc
if (!who || who[0] == '\0')
return;
- if (who[3] == '/') {
- if (!g_ascii_strncasecmp(who, "msn/", 4)) {
- fed = YAHOO_FEDERATION_MSN;
- }
- else if (!g_ascii_strncasecmp(who, "ocs/", 4)) {
- fed = YAHOO_FEDERATION_OCS;
- }
- else if (!g_ascii_strncasecmp(who, "ibm/", 4)) {
- fed = YAHOO_FEDERATION_IBM;
- }
- }
-
+ fed = yahoo_get_federation_from_name(who);
+
pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
if(fed)
@@ -4966,17 +4927,8 @@ void yahoo_rem_deny(PurpleConnection *gc
if (!who || who[0] == '\0')
return;
- if (who[3] == '/') {
- if (!g_ascii_strncasecmp(who, "msn/", 4)) {
- fed = YAHOO_FEDERATION_MSN;
- }
- else if (!g_ascii_strncasecmp(who, "ocs/", 4)) {
- fed = YAHOO_FEDERATION_OCS;
- }
- else if (!g_ascii_strncasecmp(who, "ibm/", 4)) {
- fed = YAHOO_FEDERATION_IBM;
- }
- }
+ fed = yahoo_get_federation_from_name(who);
+
pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
if(fed)
============================================================
--- libpurple/protocols/yahoo/libymsg.h d7597c9e443ba6711c7db1c4abfea1bb23b536d2
+++ libpurple/protocols/yahoo/libymsg.h b3521d7702ffbc8ae3676df4d65e28a07d61cb91
@@ -346,6 +346,7 @@ char *yahoo_convert_to_numeric(const cha
char *yahoo_convert_to_numeric(const char *str);
+YahooFederation yahoo_get_federation_from_name(const char *who);
/* yahoo_profile.c */
void yahoo_get_info(PurpleConnection *gc, const char *name);
============================================================
--- libpurple/protocols/yahoo/util.c 736709dedbe21eed260448b00cc80441f63f8227
+++ libpurple/protocols/yahoo/util.c cba4e955575af4f8c2348a54ba9d7d417c6a4a78
@@ -916,3 +916,18 @@ char *yahoo_html_to_codes(const char *sr
return g_string_free(dest, FALSE);
}
+
+YahooFederation yahoo_get_federation_from_name(const char *who)
+{
+ YahooFederation fed = YAHOO_FEDERATION_NONE;
+ if (who[3] == '/') {
+ if (!g_ascii_strncasecmp(who, "msn", 3))
+ fed = YAHOO_FEDERATION_MSN;
+ else if (!g_ascii_strncasecmp(who, "ocs", 3))
+ fed = YAHOO_FEDERATION_OCS;
+ else if (!g_ascii_strncasecmp(who, "ibm", 3))
+ fed = YAHOO_FEDERATION_IBM;
+ }
+ return fed;
+}
+
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c c3c91a52dc688dfc688bc76df861a334758f1337
+++ libpurple/protocols/yahoo/yahoo_filexfer.c 40b053d1485b2dab2565d9ce3532d2f34e55410e
@@ -1070,6 +1070,13 @@ static void yahoo_xfer_dns_connected_15(
yahoo_packet_send_and_free(pkt, yd);
}
+gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who)
+{
+ if (!who || yahoo_get_federation_from_name(who) != YAHOO_FEDERATION_NONE)
+ return FALSE;
+ return TRUE;
+}
+
void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file)
{
struct yahoo_xfer_data *xfer_data;
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.h e7584d0f48999199dc3a87b33ca473d8c879d8b3
+++ libpurple/protocols/yahoo/yahoo_filexfer.h 45d69e09b68893a472192af628078a6434090376
@@ -43,6 +43,18 @@ PurpleXfer *yahoo_new_xfer(PurpleConnect
PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who);
/**
+ * Returns TRUE if the buddy can receive file, FALSE otherwise.
+ * Federated users cannot receive files. So this will return FALSE only
+ * for them.
+ *
+ * @param gc The connection
+ * @param who The name of the remote user
+ *
+ * @return TRUE or FALSE
+ */
+gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who);
+
+/**
* Send a file.
*
* @param gc The PurpleConnection handle.
More information about the Commits
mailing list