pidgin.next.minor: 71320664: Modified patch from Stefan 'cockroach' O...

sadrul at pidgin.im sadrul at pidgin.im
Thu May 22 22:25:42 EDT 2008


-----------------------------------------------------------------
Revision: 71320664d16c85cf4292830959527b4509e2182b
Ancestor: 36289cbe05fc5125d36b8a550e0ae4adf3f3fd53
Author: sadrul at pidgin.im
Date: 2008-05-23T02:23:07
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/71320664d16c85cf4292830959527b4509e2182b

Modified files:
        ChangeLog.API doc/conversation-signals.dox
        libpurple/conversation.c libpurple/server.c

ChangeLog: 

Modified patch from Stefan 'cockroach' Ott to add blocked-im-msg and
chat-invite-blocked signals for blocked im messages and blocked chat
invites. Closes #1062.

-------------- next part --------------
============================================================
--- ChangeLog.API	7fd62ab01ef493c7e9b42debc520e85bef00df8e
+++ ChangeLog.API	c7b6b39fa37f21d2d610e27523af579f513d18a5
@@ -8,6 +8,8 @@ version 2.5.0 (??/??/2008):
 		* PurpleSmiley and the Smiley API.
 		* purple_serv_got_join_chat_failed
 		* chat-join-failed signal (see conversation-signals.dox)
+		* chat-invite-blocked and blocked-im-msg signals (see
+		  converation-signals.dox) (Thanks to Stefan Ott)
 		* purple_blist_update_node_icon
 		* purple_buddy_icons_node_has_custom_icon
 		* purple_buddy_icons_node_find_custom_icon
============================================================
--- doc/conversation-signals.dox	e32f1ee5cde569a10aa31021f7b02012a37279f0
+++ doc/conversation-signals.dox	13f7f8fcf86b36e7c6dec20e6a231a9a62e98fb0
@@ -7,6 +7,7 @@
   @signal sent-im-msg
   @signal receiving-im-msg
   @signal received-im-msg
+  @signal blocked-im-msg
   @signal writing-chat-msg
   @signal wrote-chat-msg
   @signal sending-chat-msg
@@ -26,6 +27,7 @@
   @signal chat-inviting-user
   @signal chat-invited-user
   @signal chat-invited
+  @signal chat-invite-blocked
   @signal chat-joined
   @signal chat-join-failed
   @signal chat-left
@@ -132,6 +134,21 @@ void (*received_im_msg)(PurpleAccount *a
   @param flags   The IM message flags.
  @endsignaldef
 
+ @signaldef blocked-im-msg
+  @signalproto
+void (*blocked_im_msg)(PurpleAccount *account, const char *sender,
+        const char *message, PurpleMessageFlags flags, time_t when);
+  @endsignalproto
+  @signaldesc
+   Emitted after an IM is blocked due to privacy settings.
+  @param account The account the message was received on.
+  @param sender  The username of the sender.
+  @param message The message that was blocked.
+  @param flags   The IM message flags.
+  @param when    The time the message was sent.
+  @since 2.5.0
+ @endsignaldef
+
  @signaldef writing-chat-msg
   @signalproto
 gboolean (*writing_chat_msg)(PurpleAccount *account, const char *who,
@@ -404,6 +421,21 @@ gint (*chat_invited)(PurpleAccount *acco
           default behavior will be maintained: the user will be prompted.
  @endsignaldef
 
+ @signaldef chat-invite-blocked
+  @signalproto
+void (*chat_invite_blocked)(PurpleAccount *account, const char *inviter,
+                   const char *name, const char *message, GHashTable *data);
+  @endsignalproto
+  @signaldesc
+   Emitted when an invitation to join a chat is blocked.
+  @param account  The account the invitation was sent to.
+  @param inviter  The name of the person sending the invitation.
+  @param name     The name of the chat invited to.
+  @param message  The invitation message sent.
+  @param data     Hashtable containing data about the invited chat.
+  @since 2.5.0
+ @endsignaldef
+
  @signaldef chat-joined
   @signalproto
 void (*chat_joined)(PurpleConversation *conv);
============================================================
--- libpurple/conversation.c	bb855909fc90c6b38f9d8e52cf164d62d8645cc5
+++ libpurple/conversation.c	600c9f8e6e65b8939f7d48d6c16735ab4c7b090c
@@ -2221,6 +2221,16 @@ purple_conversations_init(void)
 										PURPLE_SUBTYPE_CONVERSATION),
 						 purple_value_new(PURPLE_TYPE_UINT));
 
+	purple_signal_register(handle, "blocked-im-msg",
+						 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT,
+						 NULL, 5,
+						 purple_value_new(PURPLE_TYPE_SUBTYPE,
+							 PURPLE_SUBTYPE_ACCOUNT),
+						 purple_value_new(PURPLE_TYPE_STRING),
+						 purple_value_new(PURPLE_TYPE_STRING),
+						 purple_value_new(PURPLE_TYPE_UINT),
+						 purple_value_new(PURPLE_TYPE_UINT));
+
 	purple_signal_register(handle, "writing-chat-msg",
 						 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT,
 						 purple_value_new(PURPLE_TYPE_BOOLEAN), 5,
@@ -2376,6 +2386,16 @@ purple_conversations_init(void)
 						 purple_value_new(PURPLE_TYPE_STRING),
 						 purple_value_new(PURPLE_TYPE_POINTER));
 
+	purple_signal_register(handle, "chat-invite-blocked",
+						 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER,
+						 NULL, 5,
+						 purple_value_new(PURPLE_TYPE_SUBTYPE,
+							 PURPLE_SUBTYPE_ACCOUNT),
+						 purple_value_new(PURPLE_TYPE_STRING),
+						 purple_value_new(PURPLE_TYPE_STRING),
+						 purple_value_new(PURPLE_TYPE_STRING),
+						 purple_value_new(PURPLE_TYPE_BOXED, "GHashTable *"));
+
 	purple_signal_register(handle, "chat-joined",
 						 purple_marshal_VOID__POINTER, NULL, 1,
 						 purple_value_new(PURPLE_TYPE_SUBTYPE,
============================================================
--- libpurple/server.c	56330bd5cbd656d20cb6baec93c8dc120bb012d1
+++ libpurple/server.c	d412fa415f7a927755f54e801eb923dfd2f8b891
@@ -659,8 +659,11 @@ void serv_got_im(PurpleConnection *gc, c
 
 	if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) {
 		/* protocol does not support privacy, handle it ourselves */
-		if (!purple_privacy_check(account, who))
+		if (!purple_privacy_check(account, who)) {
+			purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg",
+					account, who, msg, flags, (unsigned int)mtime);
 			return;
+		}
 	}
 
 	/*
@@ -879,8 +882,11 @@ void serv_got_chat_invite(PurpleConnecti
 	account = purple_connection_get_account(gc);
 	if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) {
 		/* protocol does not support privacy, handle it ourselves */
-		if (!purple_privacy_check(account, who))
+		if (!purple_privacy_check(account, who)) {
+			purple_signal_emit(purple_conversations_get_handle(), "chat-invite-blocked",
+					account, who, name, message, data);
 			return;
+		}
 	}
 
 	plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1(


More information about the Commits mailing list