/soc/2013/ankitkv/gobjectification: dee62fd8249d: Merged default...
Ankit Vani
a at nevitus.org
Sat Aug 31 13:49:28 EDT 2013
Changeset: dee62fd8249db35c79ee394f981b90db6c424566
Author: Ankit Vani <a at nevitus.org>
Date: 2013-08-31 02:20 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/dee62fd8249d
Description:
Merged default branch
diffstat:
libpurple/connection.c | 20 --------------------
libpurple/connection.h | 12 ------------
libpurple/conversation.c | 21 +++++++++++++++++++++
libpurple/conversation.h | 12 ++++++++++++
libpurple/protocols/bonjour/bonjour.c | 8 +++-----
libpurple/protocols/gg/gg.c | 6 +++---
libpurple/protocols/irc/irc.c | 7 ++++---
libpurple/protocols/msn/msn.c | 6 +++---
libpurple/protocols/novell/novell.c | 6 +++---
libpurple/protocols/oscar/libicq.c | 6 +++---
libpurple/protocols/oscar/oscar.c | 6 +++---
libpurple/protocols/oscar/oscarcommon.h | 2 +-
libpurple/protocols/yahoo/libymsg.c | 7 +++----
libpurple/protocols/yahoo/libymsg.h | 2 +-
libpurple/prpl.h | 14 +++++++++-----
15 files changed, 69 insertions(+), 66 deletions(-)
diffs (298 lines):
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -560,26 +560,6 @@ void purple_connection_update_last_recei
priv->last_received = time(NULL);
}
-gsize
-purple_connection_get_max_message_size(PurpleConnection *gc)
-{
- PurplePlugin *prpl;
- PurplePluginProtocolInfo *prpl_info;
-
- g_return_val_if_fail(gc != NULL, 0);
-
- prpl = purple_connection_get_prpl(gc);
- g_return_val_if_fail(prpl != NULL, 0);
-
- prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
- g_return_val_if_fail(prpl_info != NULL, 0);
-
- if (!PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_max_message_size))
- return 0;
-
- return prpl_info->get_max_message_size(gc);
-}
-
/**************************************************************************
* GBoxed code
**************************************************************************/
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -464,18 +464,6 @@ purple_connection_error_is_fatal (Purple
*/
void purple_connection_update_last_received(PurpleConnection *gc);
-/**
- * Gets the maximum message size in bytes for the protocol. It may depend on
- * connection-specific variables (like protocol version).
- *
- * @see PurplePluginProtocolInfo#get_max_message_size
- *
- * @param gc The connection to query.
- * @return Maximum message size, or 0 if unspecified or infinite.
- */
-gsize
-purple_connection_get_max_message_size(PurpleConnection *gc);
-
/*@}*/
/**************************************************************************/
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -886,6 +886,27 @@ purple_conversation_do_command(PurpleCon
return (status == PURPLE_CMD_STATUS_OK);
}
+gssize
+purple_conversation_get_max_message_size(PurpleConversation *conv)
+{
+ PurplePlugin *prpl;
+ PurplePluginProtocolInfo *prpl_info;
+
+ g_return_val_if_fail(conv != NULL, 0);
+
+ prpl = purple_conversation_get_connection(
+ purple_connection_get_prpl(gc));
+ g_return_val_if_fail(prpl != NULL, 0);
+
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+ g_return_val_if_fail(prpl_info != NULL, 0);
+
+ if (!PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_max_message_size))
+ return 0;
+
+ return prpl_info->get_max_message_size(conv);
+}
+
/**************************************************************************
* GObject code
**************************************************************************/
diff --git a/libpurple/conversation.h b/libpurple/conversation.h
--- a/libpurple/conversation.h
+++ b/libpurple/conversation.h
@@ -619,6 +619,18 @@ GList * purple_conversation_get_extended
gboolean purple_conversation_do_command(PurpleConversation *conv,
const gchar *cmdline, const gchar *markup, gchar **error);
+/**
+ * Gets the maximum message size in bytes for the conversation.
+ *
+ * @see PurplePluginProtocolInfo#get_max_message_size
+ *
+ * @param conv The conversation to query.
+ *
+ * @return Maximum message size, 0 if unspecified, -1 for infinite.
+ */
+gssize
+purple_conversation_get_max_message_size(PurpleConversation *conv);
+
/*@}*/
/**************************************************************************/
diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c
--- a/libpurple/protocols/bonjour/bonjour.c
+++ b/libpurple/protocols/bonjour/bonjour.c
@@ -468,12 +468,10 @@ bonjour_can_receive_file(PurpleConnectio
return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL);
}
-static gsize
-bonjour_get_max_message_size(PurpleConnection *gc)
+static gssize
+bonjour_get_max_message_size(PurpleConversation *conv)
{
- /* It looks, like the message length is practically unlimited (I've
- * tried 5MB). */
- return 0;
+ return -1; /* 5MB successfully tested. */
}
static gboolean
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -1367,10 +1367,10 @@ static GHashTable * ggp_get_account_text
return table;
}
-static gsize
-ggp_get_max_message_size(PurpleConnection *gc)
+static gssize
+ggp_get_max_message_size(PurpleConversation *conv)
{
- /* it may depend on protocol version or other factors - check it */
+ /* TODO: it may depend on protocol version or other factors */
return 1232;
}
diff --git a/libpurple/protocols/irc/irc.c b/libpurple/protocols/irc/irc.c
--- a/libpurple/protocols/irc/irc.c
+++ b/libpurple/protocols/irc/irc.c
@@ -915,10 +915,11 @@ static void irc_keepalive(PurpleConnecti
irc_cmd_ping(irc, NULL, NULL, NULL);
}
-static gsize
-irc_get_max_message_size(PurpleConnection *gc)
+static gssize
+irc_get_max_message_size(PurpleConversation *conv)
{
- /* got from pidgin-otr */
+ /* TODO: this static value is got from pidgin-otr, but it depends on
+ * some factors, for example IRC channel name. */
return 417;
}
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
--- a/libpurple/protocols/msn/msn.c
+++ b/libpurple/protocols/msn/msn.c
@@ -2883,10 +2883,10 @@ static gboolean msn_uri_handler(const ch
return FALSE;
}
-static gsize
-msn_get_max_message_size(PurpleConnection *gc)
+static gssize
+msn_get_max_message_size(PurpleConversation *conv)
{
- /* pidgin-otr says: 1409 */
+ /* XXX: pidgin-otr says 1409. Verify and document it. */
return 1525 - strlen(VERSION);
}
diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c
--- a/libpurple/protocols/novell/novell.c
+++ b/libpurple/protocols/novell/novell.c
@@ -3475,10 +3475,10 @@ novell_keepalive(PurpleConnection *gc)
_check_for_disconnect(user, rc);
}
-static gsize
-novell_get_max_message_size(PurpleConnection *gc)
+static gssize
+novell_get_max_message_size(PurpleConversation *conv)
{
- /* got from pidgin-otr */
+ /* XXX: got from pidgin-otr - verify and document it */
return 1792;
}
diff --git a/libpurple/protocols/oscar/libicq.c b/libpurple/protocols/oscar/libicq.c
--- a/libpurple/protocols/oscar/libicq.c
+++ b/libpurple/protocols/oscar/libicq.c
@@ -36,10 +36,10 @@ icq_get_account_text_table(PurpleAccount
return table;
}
-static gsize
-icq_get_max_message_size(PurpleConnection *gc)
+static gssize
+icq_get_max_message_size(PurpleConversation *conv)
{
- /* got from pidgin-otr */
+ /* XXX: got from pidgin-otr - verify and document it */
return 2346;
}
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -5435,10 +5435,10 @@ oscar_offline_message(const PurpleBuddy
return TRUE;
}
-gsize
-oscar_get_max_message_size(PurpleConnection *gc)
+gssize
+oscar_get_max_message_size(PurpleConversation *conv)
{
- /* got from pidgin-otr */
+ /* XXX: got from pidgin-otr - verify and document it */
return 2343;
}
diff --git a/libpurple/protocols/oscar/oscarcommon.h b/libpurple/protocols/oscar/oscarcommon.h
--- a/libpurple/protocols/oscar/oscarcommon.h
+++ b/libpurple/protocols/oscar/oscarcommon.h
@@ -102,6 +102,6 @@ gboolean oscar_can_receive_file(PurpleCo
void oscar_send_file(PurpleConnection *gc, const char *who, const char *file);
PurpleXfer *oscar_new_xfer(PurpleConnection *gc, const char *who);
gboolean oscar_offline_message(const PurpleBuddy *buddy);
-gsize oscar_get_max_message_size(PurpleConnection *gc);
+gssize oscar_get_max_message_size(PurpleConversation *conv);
GList *oscar_actions(PurplePlugin *plugin, gpointer context);
void oscar_init(PurplePlugin *plugin, gboolean is_icq);
diff --git a/libpurple/protocols/yahoo/libymsg.c b/libpurple/protocols/yahoo/libymsg.c
--- a/libpurple/protocols/yahoo/libymsg.c
+++ b/libpurple/protocols/yahoo/libymsg.c
@@ -5130,9 +5130,8 @@ GList *yahoo_attention_types(PurpleAccou
return list;
}
-gsize
-yahoo_get_max_message_size(PurpleConnection *gc)
+gssize
+yahoo_get_max_message_size(PurpleConversation *conv)
{
- /* got from pidgin-otr */
- return 799;
+ return YAHOO_MAX_MESSAGE_LENGTH_CHARS;
}
diff --git a/libpurple/protocols/yahoo/libymsg.h b/libpurple/protocols/yahoo/libymsg.h
--- a/libpurple/protocols/yahoo/libymsg.h
+++ b/libpurple/protocols/yahoo/libymsg.h
@@ -384,7 +384,7 @@ GList *yahoo_attention_types(PurpleAccou
GList *yahoo_actions(PurplePlugin *plugin, gpointer context);
void yahoopurple_register_commands(void);
-gsize yahoo_get_max_message_size(PurpleConnection *gc);
+gssize yahoo_get_max_message_size(PurpleConversation *conv);
PurpleCmdRet yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data);
PurpleCmdRet yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data);
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -630,8 +630,10 @@ struct _PurplePluginProtocolInfo
PurpleGetPublicAliasFailureCallback failure_cb);
/**
- * Gets the maximum message size in bytes for the protocol. It may
- * depend on connection-specific variables (like protocol version).
+ * Gets the maximum message size in bytes for the conversation.
+ *
+ * It may depend on connection-specific or conversation-specific
+ * variables, like channel or buddy's name length.
*
* This value is intended for plaintext message, the exact value may be
* lower because of:
@@ -639,10 +641,12 @@ struct _PurplePluginProtocolInfo
* - formatting,
* - used special characters.
*
- * @param gc The connection to query, or NULL to get safe minimum.
- * @return Maximum message size, or 0 if unspecified or infinite.
+ * @param conv The conversation to query, or NULL to get safe minimum
+ * for the protocol.
+ *
+ * @return Maximum message size, 0 if unspecified, -1 for infinite.
*/
- gsize (*get_max_message_size)(PurpleConnection *gc);
+ gssize (*get_max_message_size)(PurpleConversation *conv);
};
#define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \
More information about the Commits
mailing list