/dev/twasilczyk/imgupload: 33978dc8ef6f: Remove redundant OPT_PR...

Tomasz Wasilczyk twasilczyk at pidgin.im
Mon May 19 04:31:00 EDT 2014


Changeset: 33978dc8ef6f83174a2b4e6c87b8f326e299e77b
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-05-19 10:30 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/twasilczyk/imgupload/rev/33978dc8ef6f

Description:

Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)

diffstat:

 libpurple/protocols/bonjour/bonjour.c   |   3 ++-
 libpurple/protocols/gg/gg.c             |   2 +-
 libpurple/protocols/irc/irc.c           |   3 ++-
 libpurple/protocols/jabber/jabber.c     |   4 +++-
 libpurple/protocols/msn/msn.c           |  11 ++++++++---
 libpurple/protocols/mxit/mxit.c         |   3 ++-
 libpurple/protocols/novell/novell.c     |   2 ++
 libpurple/protocols/null/nullprpl.c     |   2 ++
 libpurple/protocols/oscar/libaim.c      |   2 +-
 libpurple/protocols/oscar/libicq.c      |   2 +-
 libpurple/protocols/sametime/sametime.c |   2 +-
 libpurple/protocols/silc/silc.c         |   2 +-
 libpurple/protocols/simple/simple.c     |   2 ++
 libpurple/protocols/yahoo/libymsg.c     |   5 ++++-
 libpurple/protocols/zephyr/zephyr.c     |   4 +++-
 libpurple/prpl.h                        |   3 ---
 pidgin/gtkconv.c                        |   6 ------
 pidgin/gtkutils.c                       |   2 +-
 pidgin/plugins/imgupload.c              |   6 ++++++
 19 files changed, 42 insertions(+), 24 deletions(-)

diffs (295 lines):

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
@@ -103,7 +103,8 @@ bonjour_login(PurpleAccount *account)
 	}
 #endif /* _WIN32 */
 
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 	bd = g_new0(BonjourData, 1);
 	purple_connection_set_protocol_data(gc, bd);
 
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
@@ -975,7 +975,7 @@ ggp_get_max_message_size(PurpleConversat
 static PurplePluginProtocolInfo prpl_info =
 {
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
-	OPT_PROTO_IM_IMAGE,
+	0,
 	NULL,				/* user_splits */
 	NULL,				/* protocol_options */
 	{"png", 1, 1, 200, 200, 0, PURPLE_ICON_SCALE_DISPLAY | PURPLE_ICON_SCALE_SEND},	/* icon_spec */
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
@@ -337,7 +337,8 @@ static void irc_login(PurpleAccount *acc
 	const char *username = purple_account_get_username(account);
 
 	gc = purple_account_get_connection(account);
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_NEWLINES);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_NEWLINES |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 
 	if (strpbrk(username, " \t\v\r\n") != NULL) {
 		purple_connection_error (gc,
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -1086,7 +1086,9 @@ jabber_login(PurpleAccount *account)
 	JabberStream *js;
 	PurpleImage *image;
 
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML |
+		PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 	js = jabber_stream_new(account);
 	if (js == NULL)
 		return;
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
@@ -1360,9 +1360,14 @@ msn_login(PurpleAccount *account)
 	session = msn_session_new(account);
 
 	purple_connection_set_protocol_data(gc, session);
-	purple_connection_set_flags(gc, 
-		PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_FORMATTING_WBFO | PURPLE_CONNECTION_FLAG_NO_BGCOLOR |
-		PURPLE_CONNECTION_FLAG_NO_FONTSIZE | PURPLE_CONNECTION_FLAG_NO_URLDESC | PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY);
+	purple_connection_set_flags(gc,
+		PURPLE_CONNECTION_FLAG_HTML |
+		PURPLE_CONNECTION_FLAG_FORMATTING_WBFO |
+		PURPLE_CONNECTION_FLAG_NO_BGCOLOR |
+		PURPLE_CONNECTION_FLAG_NO_FONTSIZE |
+		PURPLE_CONNECTION_FLAG_NO_URLDESC |
+		PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
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
@@ -723,7 +723,8 @@ static unsigned int mxit_send_typing( Pu
 
 static PurplePluginProtocolInfo proto_info = {
 	sizeof( PurplePluginProtocolInfo ),		/* struct_size */
-	OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE,	/* options */
+	OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME |
+	OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE, /* options */
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
 	{						/* icon_spec */
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
@@ -2203,6 +2203,8 @@ novell_login(PurpleAccount * account)
 	if (gc == NULL)
 		return;
 
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_IMAGES);
+
 	server = purple_account_get_string(account, "server", NULL);
 	if (server == NULL || *server == '\0') {
 
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
@@ -369,6 +369,8 @@ static void nullprpl_login(PurpleAccount
 
   purple_debug_info("nullprpl", "logging in %s\n", purple_account_get_username(acct));
 
+  purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_IMAGES);
+
   purple_connection_update_progress(gc, _("Connecting"),
                                     0,   /* which connection step this is */
                                     2);  /* total number of steps */
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
@@ -30,7 +30,7 @@
 static PurplePluginProtocolInfo prpl_info =
 {
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
-	OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE,
+	OPT_PROTO_MAIL_CHECK | OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE,
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
 	{"gif,jpeg,bmp,ico", 0, 0, 64, 64, 7168, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
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
@@ -46,7 +46,7 @@ icq_get_max_message_size(PurpleConversat
 static PurplePluginProtocolInfo prpl_info =
 {
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
-	OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE,
+	OPT_PROTO_MAIL_CHECK | OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE,
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
 	{"gif,jpeg,bmp,ico", 0, 0, 64, 64, 7168, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c
--- a/libpurple/protocols/sametime/sametime.c
+++ b/libpurple/protocols/sametime/sametime.c
@@ -5061,7 +5061,7 @@ static void mw_prpl_send_file(PurpleConn
 
 static PurplePluginProtocolInfo mw_prpl_info = {
   sizeof(PurplePluginProtocolInfo),
-  OPT_PROTO_IM_IMAGE,
+  0,
   NULL, /*< set in mw_plugin_init */
   NULL, /*< set in mw_plugin_init */
   NO_BUDDY_ICONS,
diff --git a/libpurple/protocols/silc/silc.c b/libpurple/protocols/silc/silc.c
--- a/libpurple/protocols/silc/silc.c
+++ b/libpurple/protocols/silc/silc.c
@@ -2062,7 +2062,7 @@ static PurplePluginProtocolInfo prpl_inf
 {
 	sizeof(PurplePluginProtocolInfo),       /* struct_size */
 	OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME |
-	OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE |
+	OPT_PROTO_PASSWORD_OPTIONAL |
 	OPT_PROTO_SLASH_COMMANDS_NATIVE,
 	NULL,					/* user_splits */
 	NULL,					/* protocol_options */
diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c
--- a/libpurple/protocols/simple/simple.c
+++ b/libpurple/protocols/simple/simple.c
@@ -1925,6 +1925,8 @@ static void simple_login(PurpleAccount *
 	const char *username = purple_account_get_username(account);
 	gc = purple_account_get_connection(account);
 
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_NO_IMAGES);
+
 	if (strpbrk(username, " \t\v\r\n") != NULL) {
 		purple_connection_error(gc,
 			PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
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
@@ -3763,7 +3763,10 @@ void yahoo_login(PurpleAccount *account)
 	PurpleStatus *status = purple_account_get_active_status(account);
 
 	purple_connection_set_protocol_data(gc, yd);
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_NO_BGCOLOR | PURPLE_CONNECTION_FLAG_NO_URLDESC);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML |
+		PURPLE_CONNECTION_FLAG_NO_BGCOLOR |
+		PURPLE_CONNECTION_FLAG_NO_URLDESC |
+		PURPLE_CONNECTION_FLAG_NO_IMAGES);
 
 	purple_connection_update_progress(gc, _("Connecting"), 1, 2);
 
diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c
--- a/libpurple/protocols/zephyr/zephyr.c
+++ b/libpurple/protocols/zephyr/zephyr.c
@@ -1579,7 +1579,9 @@ static void zephyr_login(PurpleAccount *
 #ifdef WIN32
 	username = purple_account_get_username(account);
 #endif
-	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_AUTO_RESP | PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_NO_BGCOLOR | PURPLE_CONNECTION_FLAG_NO_URLDESC);
+	purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_AUTO_RESP |
+		PURPLE_CONNECTION_FLAG_HTML | PURPLE_CONNECTION_FLAG_NO_BGCOLOR |
+		PURPLE_CONNECTION_FLAG_NO_URLDESC | PURPLE_CONNECTION_FLAG_NO_IMAGES);
 	zephyr = g_new0(zephyr_account, 1);
 	purple_connection_set_protocol_data(gc, zephyr);
 
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -157,8 +157,6 @@ struct proto_chat_entry {
  *           password prompt.
  * @OPT_PROTO_MAIL_CHECK: Notify on new mail.<sbr/>
  *           MSN and Yahoo notify you when you have new mail.
- * @OPT_PROTO_IM_IMAGE: Images in IMs.<sbr/>
- *           Oscar lets you send images in direct IMs.
  * @OPT_PROTO_PASSWORD_OPTIONAL: Allow passwords to be optional.<sbr/>
  *           Passwords in IRC are optional, and are needed for certain
  *           functionality.
@@ -192,7 +190,6 @@ typedef enum  /*< flags >*/
 	OPT_PROTO_CHAT_TOPIC                    = 0x00000008,
 	OPT_PROTO_NO_PASSWORD                   = 0x00000010,
 	OPT_PROTO_MAIL_CHECK                    = 0x00000020,
-	OPT_PROTO_IM_IMAGE                      = 0x00000040,
 	OPT_PROTO_PASSWORD_OPTIONAL             = 0x00000080,
 	OPT_PROTO_USE_POINTSIZE                 = 0x00000100,
 	OPT_PROTO_REGISTER_NOSCREENNAME         = 0x00000200,
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -7405,12 +7405,6 @@ gray_stuff_out(PidginConversation *gtkco
 			buttons = PIDGIN_WEBVIEW_SMILEY | PIDGIN_WEBVIEW_IMAGE;
 		}
 
-		if (!(prpl_info->options & OPT_PROTO_IM_IMAGE)
-		 && !(features & PURPLE_CONNECTION_FLAG_NO_IMAGES)) {
-			features |= PURPLE_CONNECTION_FLAG_NO_IMAGES;
-			purple_conversation_set_features(conv, features);
-		}
-
 		if (features & PURPLE_CONNECTION_FLAG_NO_IMAGES)
 			buttons &= ~PIDGIN_WEBVIEW_IMAGE;
 
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -1522,7 +1522,7 @@ pidgin_dnd_file_manage(GtkSelectionData 
 			if (gc)
 				prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
 
-			if (prpl_info && prpl_info->options & OPT_PROTO_IM_IMAGE)
+			if (!(purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_NO_IMAGES))
 				im = TRUE;
 
 			if (prpl_info && prpl_info->can_receive_file)
diff --git a/pidgin/plugins/imgupload.c b/pidgin/plugins/imgupload.c
--- a/pidgin/plugins/imgupload.c
+++ b/pidgin/plugins/imgupload.c
@@ -41,6 +41,7 @@
  * Plugin setup
  ******************************************************************************/
 
+#if 0
 static void
 imgup_prpl_init(PurplePlugin *prpl)
 {
@@ -68,10 +69,12 @@ imgup_prpl_uninit(PurplePlugin *prpl)
 
 	purple_plugin_set_data(prpl, "imgupload-set", NULL);
 }
+#endif
 
 static gboolean
 imgup_plugin_load(PurplePlugin *plugin)
 {
+#if 0
 	GList *it;
 
 	it = purple_plugins_get_protocols();
@@ -79,6 +82,7 @@ imgup_plugin_load(PurplePlugin *plugin)
 		PurplePlugin *prpl = it->data;
 		imgup_prpl_init(prpl);
 	}
+#endif
 
 	return TRUE;
 }
@@ -86,6 +90,7 @@ imgup_plugin_load(PurplePlugin *plugin)
 static gboolean
 imgup_plugin_unload(PurplePlugin *plugin)
 {
+#if 0
 	GList *it;
 
 	it = purple_plugins_get_protocols();
@@ -93,6 +98,7 @@ imgup_plugin_unload(PurplePlugin *plugin
 		PurplePlugin *prpl = it->data;
 		imgup_prpl_uninit(prpl);
 	}
+#endif
 
 	return TRUE;
 }



More information about the Commits mailing list