/soc/2013/ankitkv/gobjectification: df5ed3731148: Merged default...

Ankit Vani a at nevitus.org
Mon Aug 26 19:01:22 EDT 2013


Changeset: df5ed373114860caa6b1cee896458fc4121a0e8d
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-27 04:18 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/df5ed3731148

Description:

Merged default branch

diffstat:

 libpurple/connection.c                   |  20 ++++++++++++++++++++
 libpurple/connection.h                   |  12 ++++++++++++
 libpurple/protocols/bonjour/bonjour.c    |  11 ++++++++++-
 libpurple/protocols/gg/gg.c              |  10 +++++++++-
 libpurple/protocols/irc/irc.c            |  10 +++++++++-
 libpurple/protocols/jabber/libfacebook.c |   3 ++-
 libpurple/protocols/jabber/libgtalk.c    |   3 ++-
 libpurple/protocols/jabber/libxmpp.c     |   3 ++-
 libpurple/protocols/msn/msn.c            |   9 ++++++++-
 libpurple/protocols/mxit/mxit.c          |   3 ++-
 libpurple/protocols/myspace/myspace.c    |   3 ++-
 libpurple/protocols/novell/novell.c      |  10 +++++++++-
 libpurple/protocols/null/nullprpl.c      |   3 ++-
 libpurple/protocols/oscar/libaim.c       |   3 ++-
 libpurple/protocols/oscar/libicq.c       |  10 +++++++++-
 libpurple/protocols/oscar/oscar.c        |   7 +++++++
 libpurple/protocols/oscar/oscarcommon.h  |   1 +
 libpurple/protocols/sametime/sametime.c  |   1 +
 libpurple/protocols/silc/silc.c          |   3 ++-
 libpurple/protocols/simple/simple.c      |   3 ++-
 libpurple/protocols/yahoo/libyahoo.c     |   3 ++-
 libpurple/protocols/yahoo/libyahoojp.c   |   3 ++-
 libpurple/protocols/yahoo/libymsg.c      |   6 ++++++
 libpurple/protocols/yahoo/libymsg.h      |   1 +
 libpurple/protocols/zephyr/zephyr.c      |   3 ++-
 libpurple/prpl.h                         |  15 +++++++++++++++
 26 files changed, 141 insertions(+), 18 deletions(-)

diffs (truncated from 457 to 300 lines):

diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -560,6 +560,26 @@ 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,6 +464,18 @@ purple_connection_error_is_fatal (Purple
  */
 void purple_connection_update_last_received(PurpleConnection *gc);
 
+/**
+ * Gets the maximum message size 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/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c
--- a/libpurple/protocols/bonjour/bonjour.c
+++ b/libpurple/protocols/bonjour/bonjour.c
@@ -468,6 +468,14 @@ bonjour_can_receive_file(PurpleConnectio
 	return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL);
 }
 
+static gsize
+bonjour_get_max_message_size(PurpleConnection *gc)
+{
+	/* It looks, like the message length is practically unlimited (I've
+	 * tried 5MB). */
+	return 0;
+}
+
 static gboolean
 plugin_unload(PurplePlugin *plugin)
 {
@@ -553,7 +561,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,                                                    /* get_media_caps */
 	NULL,                                                    /* get_moods */
 	NULL,                                                    /* set_public_alias */
-	NULL                                                     /* get_public_alias */
+	NULL,                                                    /* get_public_alias */
+	bonjour_get_max_message_size                             /* get_max_message_size */
 };
 
 static PurplePluginInfo info =
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,6 +1367,13 @@ static GHashTable * ggp_get_account_text
 	return table;
 }
 
+static gsize
+ggp_get_max_message_size(PurpleConnection *gc)
+{
+	/* it may depend on protocol version or other factors - check it */
+	return 1232;
+}
+
 static PurplePluginProtocolInfo prpl_info =
 {
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
@@ -1439,7 +1446,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,				/* can_do_media */
 	NULL,				/* get_moods */
 	NULL,				/* set_public_alias */
-	NULL				/* get_public_alias */
+	NULL,				/* get_public_alias */
+	ggp_get_max_message_size	/* get_max_message_size */
 };
 
 static gboolean ggp_load(PurplePlugin *plugin);
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,6 +915,13 @@ static void irc_keepalive(PurpleConnecti
 		irc_cmd_ping(irc, NULL, NULL, NULL);
 }
 
+static gsize
+irc_get_max_message_size(PurpleConnection *gc)
+{
+	/* got from pidgin-otr */
+	return 417;
+}
+
 static PurplePluginProtocolInfo prpl_info =
 {
 	sizeof(PurplePluginProtocolInfo),    /* struct_size */
@@ -988,7 +995,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,					 /* get_media_caps */
 	NULL,					 /* get_moods */
 	NULL,					 /* set_public_alias */
-	NULL					 /* get_public_alias */
+	NULL,					 /* get_public_alias */
+	irc_get_max_message_size		/* get_max_message_size */
 };
 
 static gboolean load_plugin (PurplePlugin *plugin) {
diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c
--- a/libpurple/protocols/jabber/libfacebook.c
+++ b/libpurple/protocols/jabber/libfacebook.c
@@ -133,7 +133,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,							/* get_media_caps */
 	NULL,							/* get_moods */
 	NULL, /* set_public_alias */
-	NULL  /* get_public_alias */
+	NULL, /* get_public_alias */
+	NULL  /* get_max_message_size */
 };
 
 static gboolean load_plugin(PurplePlugin *plugin)
diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c
--- a/libpurple/protocols/jabber/libgtalk.c
+++ b/libpurple/protocols/jabber/libgtalk.c
@@ -133,7 +133,8 @@ static PurplePluginProtocolInfo prpl_inf
 	jabber_get_media_caps,                  /* get_media_caps */
 	jabber_get_moods,  							/* get_moods */
 	NULL, /* set_public_alias */
-	NULL  /* get_public_alias */
+	NULL, /* get_public_alias */
+	NULL  /* get_max_message_size */
 };
 
 static gboolean load_plugin(PurplePlugin *plugin)
diff --git a/libpurple/protocols/jabber/libxmpp.c b/libpurple/protocols/jabber/libxmpp.c
--- a/libpurple/protocols/jabber/libxmpp.c
+++ b/libpurple/protocols/jabber/libxmpp.c
@@ -127,7 +127,8 @@ static PurplePluginProtocolInfo prpl_inf
 	jabber_get_media_caps,                  /* get_media_caps */
 	jabber_get_moods,  							/* get_moods */
 	NULL, /* set_public_alias */
-	NULL  /* get_public_alias */
+	NULL, /* get_public_alias */
+	NULL  /* get_max_message_size */
 };
 
 static gboolean load_plugin(PurplePlugin *plugin)
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,6 +2883,12 @@ static gboolean msn_uri_handler(const ch
 	return FALSE;
 }
 
+static gsize
+msn_get_max_message_size(PurpleConnection *gc)
+{
+	/* pidgin-otr says: 1409 */
+	return 1525 - strlen(VERSION);
+}
 
 static PurplePluginProtocolInfo prpl_info =
 {
@@ -2956,7 +2962,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,                               /* get_media_caps */
 	NULL,                               /* get_moods */
 	msn_set_public_alias,               /* set_public_alias */
-	msn_get_public_alias                /* get_public_alias */
+	msn_get_public_alias,               /* get_public_alias */
+	msn_get_max_message_size            /* get_max_message_size */
 };
 
 static PurplePluginInfo info =
diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c
--- a/libpurple/protocols/mxit/mxit.c
+++ b/libpurple/protocols/mxit/mxit.c
@@ -793,7 +793,8 @@ static PurplePluginProtocolInfo proto_in
 	mxit_media_caps,		/* get_media_caps */
 	mxit_get_moods,			/* get_moods */
 	NULL,					/* set_public_alias */
-	NULL					/* get_public_alias */
+	NULL,					/* get_public_alias */
+	NULL					/* get_max_message_size */
 };
 
 
diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c
--- a/libpurple/protocols/myspace/myspace.c
+++ b/libpurple/protocols/myspace/myspace.c
@@ -3079,7 +3079,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,                   /* get_media_caps */
 	NULL,                   /* get_moods */
 	NULL,                   /* set_public_alias */
-	NULL                    /* get_public_alias */
+	NULL,                   /* get_public_alias */
+	NULL                    /* get_max_message_size */
 };
 
 /**
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,6 +3475,13 @@ novell_keepalive(PurpleConnection *gc)
 	_check_for_disconnect(user, rc);
 }
 
+static gsize
+novell_get_max_message_size(PurpleConnection *gc)
+{
+	/* got from pidgin-otr */
+	return 1792;
+}
+
 static PurplePluginProtocolInfo prpl_info = {
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
 	0,
@@ -3546,7 +3553,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,						/* get_media_caps */
 	NULL,						/* get_moods */
 	NULL,						/* set_public_alias */
-	NULL						/* get_public_alias */
+	NULL,						/* get_public_alias */
+	novell_get_max_message_size			/* get_max_message_size */
 };
 
 static PurplePluginInfo info = {
diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c
--- a/libpurple/protocols/null/nullprpl.c
+++ b/libpurple/protocols/null/nullprpl.c
@@ -1137,7 +1137,8 @@ static PurplePluginProtocolInfo prpl_inf
   NULL,                                /* get_media_caps */
   NULL,                                /* get_moods */
   NULL,                                /* set_public_alias */
-  NULL                                 /* get_public_alias */
+  NULL,                                /* get_public_alias */
+  NULL                                 /* get_max_message_size */
 };
 
 static void nullprpl_init(PurplePlugin *plugin)
diff --git a/libpurple/protocols/oscar/libaim.c b/libpurple/protocols/oscar/libaim.c
--- a/libpurple/protocols/oscar/libaim.c
+++ b/libpurple/protocols/oscar/libaim.c
@@ -99,7 +99,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,					/* get_media_caps */
 	NULL,					/* get_moods */
 	NULL,					/* set_public_alias */
-	NULL					/* get_public_alias */
+	NULL,					/* get_public_alias */
+	oscar_get_max_message_size		/* get_max_message_size */
 };
 
 static PurplePluginInfo info =
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,6 +36,13 @@ icq_get_account_text_table(PurpleAccount
 	return table;
 }
 
+static gsize
+icq_get_max_message_size(PurpleConnection *gc)
+{
+	/* got from pidgin-otr */
+	return 2346;
+}
+
 static PurplePluginProtocolInfo prpl_info =
 {
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
@@ -108,7 +115,8 @@ static PurplePluginProtocolInfo prpl_inf
 	NULL,					/* can_do_media */
 	oscar_get_purple_moods, /* get_moods */
 	NULL,					/* set_public_alias */
-	NULL					/* get_public_alias */



More information about the Commits mailing list