gossip r2804 - in trunk: . data/glade libgossip src



Author: mr
Date: Wed May 14 16:13:10 2008
New Revision: 2804
URL: http://svn.gnome.org/viewvc/gossip?rev=2804&view=rev

Log:
Only allow kicking and subject changing if privileges allow it in chatrooms


Modified:
   trunk/ChangeLog
   trunk/data/glade/chat.glade
   trunk/libgossip/gossip-chatroom-provider.c
   trunk/libgossip/gossip-chatroom-provider.h
   trunk/libgossip/gossip-chatroom.c
   trunk/libgossip/gossip-chatroom.h
   trunk/libgossip/gossip-jabber-chatrooms.c
   trunk/libgossip/gossip-jabber-chatrooms.h
   trunk/libgossip/gossip-jabber.c
   trunk/src/gossip-chat-window.c
   trunk/src/gossip-chat.c
   trunk/src/gossip-group-chat.c
   trunk/src/gossip-group-chat.h

Modified: trunk/data/glade/chat.glade
==============================================================================
--- trunk/data/glade/chat.glade	(original)
+++ trunk/data/glade/chat.glade	Wed May 14 16:13:10 2008
@@ -316,15 +316,15 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkMenuItem" id="menu_room_set_topic">
+		    <widget class="GtkMenuItem" id="menu_room_change_subject">
 		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Change _Topic...</property>
+		      <property name="label" translatable="yes">Change Subjec_t...</property>
 		      <property name="use_underline">True</property>
 		    </widget>
 		  </child>
 
 		  <child>
-		    <widget class="GtkMenuItem" id="menu_room_set_nick">
+		    <widget class="GtkMenuItem" id="menu_room_change_nick">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">Change Na_me...</property>
 		      <property name="use_underline">True</property>

Modified: trunk/libgossip/gossip-chatroom-provider.c
==============================================================================
--- trunk/libgossip/gossip-chatroom-provider.c	(original)
+++ trunk/libgossip/gossip-chatroom-provider.c	Wed May 14 16:13:10 2008
@@ -34,7 +34,7 @@
 	CHATROOM_KICKED,
 	CHATROOM_NEW_MESSAGE,
 	CHATROOM_NEW_EVENT,
-	CHATROOM_TOPIC_CHANGED,
+	CHATROOM_SUBJECT_CHANGED,
 	CHATROOM_ERROR,
 	LAST_SIGNAL
 };
@@ -114,8 +114,8 @@
 				      libgossip_marshal_VOID__INT_STRING,
 				      G_TYPE_NONE,
 				      2, G_TYPE_INT, G_TYPE_STRING);
-		signals[CHATROOM_TOPIC_CHANGED] =
-			g_signal_new ("chatroom-topic-changed",
+		signals[CHATROOM_SUBJECT_CHANGED] =
+			g_signal_new ("chatroom-subject-changed",
 				      G_TYPE_FROM_CLASS (g_class),
 				      G_SIGNAL_RUN_LAST,
 				      0,
@@ -187,18 +187,18 @@
 }
 
 void
-gossip_chatroom_provider_change_topic (GossipChatroomProvider *provider,
-				       GossipChatroomId        id,
-				       const gchar            *new_topic)
+gossip_chatroom_provider_change_subject (GossipChatroomProvider *provider,
+					 GossipChatroomId        id,
+					 const gchar            *new_subject)
 {
 	g_return_if_fail (GOSSIP_IS_CHATROOM_PROVIDER (provider));
 	g_return_if_fail (id > 0);
-	g_return_if_fail (new_topic != NULL);
+	g_return_if_fail (new_subject != NULL);
 
-	if (GOSSIP_CHATROOM_PROVIDER_GET_IFACE (provider)->change_topic) {
-		GOSSIP_CHATROOM_PROVIDER_GET_IFACE (provider)->change_topic(provider,
-									    id,
-									    new_topic);
+	if (GOSSIP_CHATROOM_PROVIDER_GET_IFACE (provider)->change_subject) {
+		GOSSIP_CHATROOM_PROVIDER_GET_IFACE (provider)->change_subject (provider,
+									       id,
+									       new_subject);
 	}
 }
 

Modified: trunk/libgossip/gossip-chatroom-provider.h
==============================================================================
--- trunk/libgossip/gossip-chatroom-provider.h	(original)
+++ trunk/libgossip/gossip-chatroom-provider.h	Wed May 14 16:13:10 2008
@@ -60,9 +60,9 @@
 	void             (*send)            (GossipChatroomProvider *provider,
 					     GossipChatroomId        id,
 					     const gchar            *message);
-	void             (*change_topic)    (GossipChatroomProvider *provider,
+	void             (*change_subject)  (GossipChatroomProvider *provider,
 					     GossipChatroomId        id,
-					     const gchar            *new_topic);
+					     const gchar            *new_subject);
 	void             (*change_nick)     (GossipChatroomProvider *provider,
 					     GossipChatroomId        id,
 					     const gchar            *new_nick);
@@ -108,9 +108,9 @@
 void         gossip_chatroom_provider_send               (GossipChatroomProvider *provider,
 							  GossipChatroomId        id,
 							  const gchar            *message);
-void         gossip_chatroom_provider_change_topic       (GossipChatroomProvider *provider,
+void         gossip_chatroom_provider_change_subject     (GossipChatroomProvider *provider,
 							  GossipChatroomId        id,
-							  const gchar            *new_topic);
+							  const gchar            *new_subject);
 void         gossip_chatroom_provider_change_nick        (GossipChatroomProvider *provider,
 							  GossipChatroomId        id,
 							  const gchar            *new_nick);

Modified: trunk/libgossip/gossip-chatroom.c
==============================================================================
--- trunk/libgossip/gossip-chatroom.c	(original)
+++ trunk/libgossip/gossip-chatroom.c	Wed May 14 16:13:10 2008
@@ -208,7 +208,7 @@
 					 PROP_SUBJECT,
 					 g_param_spec_string ("subject",
 							      "Chatroom Subject",
-							      "The conversation topic",
+							      "The conversation subject",
 							      "Random Crap",
 							      G_PARAM_READWRITE));
 
@@ -1228,3 +1228,100 @@
 	}
 }
 
+gboolean 
+gossip_chatroom_contact_can_message_all (GossipChatroom *chatroom,
+					 GossipContact  *contact)
+{
+	GossipChatroomPriv        *priv;
+	GossipChatroomContactInfo *info;
+
+	g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), FALSE);
+	g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE);
+
+	priv = GET_PRIV (chatroom);
+
+	info = gossip_chatroom_get_contact_info	(chatroom, contact);
+	if (!info) {
+		return FALSE;
+	}
+
+	if (info->role != GOSSIP_CHATROOM_ROLE_PARTICIPANT &&
+	    info->role != GOSSIP_CHATROOM_ROLE_MODERATOR) {
+		return FALSE;
+	}
+	
+	return TRUE;
+}
+
+gboolean 
+gossip_chatroom_contact_can_change_subject (GossipChatroom *chatroom,
+					    GossipContact  *contact)
+{
+	GossipChatroomPriv        *priv;
+	GossipChatroomContactInfo *info;
+
+	g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), FALSE);
+	g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE);
+
+	priv = GET_PRIV (chatroom);
+
+	info = gossip_chatroom_get_contact_info	(chatroom, contact);
+	if (!info) {
+		return FALSE;
+	}
+
+	if (info->role != GOSSIP_CHATROOM_ROLE_PARTICIPANT &&
+	    info->role != GOSSIP_CHATROOM_ROLE_MODERATOR) {
+		return FALSE;
+	}
+	
+	return TRUE;
+}
+
+gboolean 
+gossip_chatroom_contact_can_kick (GossipChatroom *chatroom,
+				  GossipContact  *contact)
+{
+	GossipChatroomPriv        *priv;
+	GossipChatroomContactInfo *info;
+
+	g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), FALSE);
+	g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE);
+
+	priv = GET_PRIV (chatroom);
+
+	info = gossip_chatroom_get_contact_info	(chatroom, contact);
+	if (!info) {
+		return FALSE;
+	}
+
+	if (info->role != GOSSIP_CHATROOM_ROLE_MODERATOR) {
+		return FALSE;
+	}
+	
+	return TRUE;
+}
+
+gboolean 
+gossip_chatroom_contact_can_change_role (GossipChatroom *chatroom,
+					 GossipContact  *contact)
+{
+	GossipChatroomPriv        *priv;
+	GossipChatroomContactInfo *info;
+
+	g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), FALSE);
+	g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE);
+
+	priv = GET_PRIV (chatroom);
+
+	info = gossip_chatroom_get_contact_info	(chatroom, contact);
+	if (!info) {
+		return FALSE;
+	}
+
+	if (info->role != GOSSIP_CHATROOM_ROLE_MODERATOR) {
+		return FALSE;
+	}
+	
+	return TRUE;
+}

Modified: trunk/libgossip/gossip-chatroom.h
==============================================================================
--- trunk/libgossip/gossip-chatroom.h	(original)
+++ trunk/libgossip/gossip-chatroom.h	Wed May 14 16:13:10 2008
@@ -142,81 +142,95 @@
 };
 
 /* Chatroom */
-GType             gossip_chatroom_get_type             (void) G_GNUC_CONST;
+GType          gossip_chatroom_get_type                (void) G_GNUC_CONST;
+GossipAccount * 
+               gossip_chatroom_get_account             (GossipChatroom           *chatroom);
+GossipChatroomId 
+               gossip_chatroom_get_id                  (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_id_str              (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_name                (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_description         (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_subject             (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_nick                (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_server              (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_room                (GossipChatroom           *chatroom);
+const gchar *  gossip_chatroom_get_password            (GossipChatroom           *chatroom);
+gboolean       gossip_chatroom_get_auto_connect        (GossipChatroom           *chatroom);
+gboolean       gossip_chatroom_get_favourite           (GossipChatroom           *chatroom);
 
-GossipAccount *   gossip_chatroom_get_account          (GossipChatroom  *chatroom);
-GossipChatroomId  gossip_chatroom_get_id               (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_id_str           (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_name             (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_description      (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_subject          (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_nick             (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_server           (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_room             (GossipChatroom  *chatroom);
-const gchar *     gossip_chatroom_get_password         (GossipChatroom  *chatroom);
-gboolean          gossip_chatroom_get_auto_connect     (GossipChatroom  *chatroom);
-gboolean          gossip_chatroom_get_favourite        (GossipChatroom  *chatroom);
 GossipChatroomFeature
-                  gossip_chatroom_get_features         (GossipChatroom  *chatroom);
+               gossip_chatroom_get_features            (GossipChatroom            *chatroom);
 GossipChatroomStatus
-                  gossip_chatroom_get_status           (GossipChatroom  *chatroom);
-guint             gossip_chatroom_get_occupants        (GossipChatroom  *chatroom);
+               gossip_chatroom_get_status              (GossipChatroom            *chatroom);
+guint          gossip_chatroom_get_occupants           (GossipChatroom            *chatroom);
 GossipChatroomError
-                  gossip_chatroom_get_last_error       (GossipChatroom  *chatroom);
+               gossip_chatroom_get_last_error          (GossipChatroom            *chatroom);
 GossipChatroomContactInfo *
-                  gossip_chatroom_get_contact_info     (GossipChatroom  *chatroom,
-							GossipContact   *contact);
+               gossip_chatroom_get_contact_info        (GossipChatroom            *chatroom,
+							GossipContact             *contact);
 
-void              gossip_chatroom_set_account          (GossipChatroom  *chatroom,
-							GossipAccount   *account);
-void              gossip_chatroom_set_name             (GossipChatroom  *chatroom,
-							const gchar     *name);
-void              gossip_chatroom_set_description      (GossipChatroom  *chatroom,
-							const gchar     *description);
-void              gossip_chatroom_set_subject          (GossipChatroom  *chatroom,
-							const gchar     *subject);
-void              gossip_chatroom_set_nick             (GossipChatroom  *chatroom,
-							const gchar     *nick);
-void              gossip_chatroom_set_server           (GossipChatroom  *chatroom,
-							const gchar     *server);
-void              gossip_chatroom_set_room             (GossipChatroom  *chatroom,
-							const gchar     *room);
-void              gossip_chatroom_set_password         (GossipChatroom  *chatroom,
-							const gchar     *password);
-void              gossip_chatroom_set_auto_connect     (GossipChatroom  *chatroom,
-							gboolean         auto_connect);
-void              gossip_chatroom_set_favourite        (GossipChatroom  *chatroom,
-							gboolean         favourite);
-void              gossip_chatroom_set_features         (GossipChatroom  *chatroom,
-							GossipChatroomFeature features);
-void              gossip_chatroom_set_status           (GossipChatroom  *chatroom,
-							GossipChatroomStatus status);
-void              gossip_chatroom_set_occupants        (GossipChatroom  *chatroom,
-							guint            occupants);
-void              gossip_chatroom_set_last_error       (GossipChatroom  *chatroom,
-							GossipChatroomError last_error);
-void              gossip_chatroom_set_contact_info     (GossipChatroom  *chatroom,
-							GossipContact   *contact,
+void           gossip_chatroom_set_account             (GossipChatroom            *chatroom,
+							GossipAccount             *account);
+void           gossip_chatroom_set_name                (GossipChatroom            *chatroom,
+							const gchar               *name);
+void           gossip_chatroom_set_description         (GossipChatroom            *chatroom,
+							const gchar               *description);
+void           gossip_chatroom_set_subject             (GossipChatroom            *chatroom,
+							const gchar               *subject);
+void           gossip_chatroom_set_nick                (GossipChatroom            *chatroom,
+							const gchar               *nick);
+void           gossip_chatroom_set_server              (GossipChatroom            *chatroom,
+							const gchar               *server);
+void           gossip_chatroom_set_room                (GossipChatroom            *chatroom,
+							const gchar               *room);
+void           gossip_chatroom_set_password            (GossipChatroom            *chatroom,
+							const gchar               *password);
+void           gossip_chatroom_set_auto_connect        (GossipChatroom            *chatroom,
+							gboolean                   auto_connect);
+void           gossip_chatroom_set_favourite           (GossipChatroom            *chatroom,
+							gboolean                   favourite);
+void           gossip_chatroom_set_features            (GossipChatroom            *chatroom,
+							GossipChatroomFeature      features);
+void           gossip_chatroom_set_status              (GossipChatroom            *chatroom,
+							GossipChatroomStatus       status);
+void           gossip_chatroom_set_occupants           (GossipChatroom            *chatroom,
+							guint                      occupants);
+void           gossip_chatroom_set_last_error          (GossipChatroom            *chatroom,
+							GossipChatroomError        last_error);
+void           gossip_chatroom_set_contact_info        (GossipChatroom            *chatroom,
+							GossipContact             *contact,
 							GossipChatroomContactInfo *info);
 
 /* Utils */
-guint             gossip_chatroom_hash                  (gconstpointer   key);
-gboolean          gossip_chatroom_equal                 (gconstpointer   v1,
-							 gconstpointer   v2);
-gboolean          gossip_chatroom_equal_full            (gconstpointer   v1,
-							 gconstpointer   v2);
-const gchar *     gossip_chatroom_status_to_string      (GossipChatroomStatus status);
-const gchar *     gossip_chatroom_error_to_string       (GossipChatroomError error);
-const gchar *     gossip_chatroom_role_to_string        (GossipChatroomRole role,
-							 gint               nr);
-const gchar *
-                  gossip_chatroom_affiliation_to_string (GossipChatroomAffiliation  affiliation,
-							 gint                       nr);
-void              gossip_chatroom_contact_joined        (GossipChatroom  *chatroom,
-							 GossipContact   *contact,
-							 GossipChatroomContactInfo *info);
-void              gossip_chatroom_contact_left          (GossipChatroom  *chatroom,
-							 GossipContact   *contact);
+guint          gossip_chatroom_hash                    (gconstpointer              key);
+gboolean       gossip_chatroom_equal                   (gconstpointer              v1,
+							gconstpointer              v2);
+gboolean       gossip_chatroom_equal_full              (gconstpointer              v1,
+							gconstpointer              v2);
+const gchar *  gossip_chatroom_status_to_string        (GossipChatroomStatus       status);
+const gchar *  gossip_chatroom_error_to_string         (GossipChatroomError        error);
+const gchar *  gossip_chatroom_role_to_string          (GossipChatroomRole         role,
+							gint                       nr);
+const gchar *  gossip_chatroom_affiliation_to_string   (GossipChatroomAffiliation  affiliation,
+							gint                       nr);
+
+/* Actions */
+void           gossip_chatroom_contact_joined          (GossipChatroom            *chatroom,
+							GossipContact             *contact,
+							GossipChatroomContactInfo *info);
+void           gossip_chatroom_contact_left            (GossipChatroom            *chatroom,
+							GossipContact             *contact);
+
+/* Privileges */
+gboolean       gossip_chatroom_contact_can_message_all (GossipChatroom            *chatroom,
+							GossipContact             *contact);
+gboolean       gossip_chatroom_contact_can_change_subject 
+                                                        (GossipChatroom           *chatroom,
+							 GossipContact            *contact);
+gboolean       gossip_chatroom_contact_can_kick         (GossipChatroom           *chatroom,
+							 GossipContact            *contact);
+gboolean       gossip_chatroom_contact_can_change_role  (GossipChatroom           *chatroom,
+							 GossipContact            *contact);
 
 G_BEGIN_DECLS
 

Modified: trunk/libgossip/gossip-jabber-chatrooms.c
==============================================================================
--- trunk/libgossip/gossip-jabber-chatrooms.c	(original)
+++ trunk/libgossip/gossip-jabber-chatrooms.c	Wed May 14 16:13:10 2008
@@ -386,7 +386,7 @@
 		contact = jabber_chatrooms_get_contact (room, jid, NULL);
 
 		g_signal_emit_by_name (chatrooms->jabber,
-				       "chatroom-topic-changed",
+				       "chatroom-subject-changed",
 				       id, contact, node->value);
 	}
 
@@ -1170,16 +1170,16 @@
 }
 
 void
-gossip_jabber_chatrooms_change_topic (GossipJabberChatrooms *chatrooms,
-				      GossipChatroomId       id,
-				      const gchar           *new_topic)
+gossip_jabber_chatrooms_change_subject (GossipJabberChatrooms *chatrooms,
+					GossipChatroomId       id,
+					const gchar           *new_subject)
 {
 	JabberChatroom *room;
 	const gchar    *without_resource;
 	LmMessage      *m;
 
 	g_return_if_fail (chatrooms != NULL);
-	g_return_if_fail (new_topic != NULL);
+	g_return_if_fail (new_subject != NULL);
 
 	room = g_hash_table_lookup (chatrooms->room_id_hash,
 				    GINT_TO_POINTER (id));
@@ -1188,8 +1188,8 @@
 		return;
 	}
 
-	gossip_debug (DEBUG_DOMAIN, "ID[%d] Change topic to:'%s'",
-		      id, new_topic);
+	gossip_debug (DEBUG_DOMAIN, "ID[%d] Change subject to:'%s'",
+		      id, new_subject);
 
 	without_resource = gossip_jid_get_without_resource (room->jid);
 
@@ -1197,7 +1197,7 @@
 					  LM_MESSAGE_TYPE_MESSAGE,
 					  LM_MESSAGE_SUB_TYPE_GROUPCHAT);
 
-	lm_message_node_add_child (m->node, "subject", new_topic);
+	lm_message_node_add_child (m->node, "subject", new_subject);
 
 	lm_connection_send (chatrooms->connection, m, NULL);
 	lm_message_unref (m);

Modified: trunk/libgossip/gossip-jabber-chatrooms.h
==============================================================================
--- trunk/libgossip/gossip-jabber-chatrooms.h	(original)
+++ trunk/libgossip/gossip-jabber-chatrooms.h	Wed May 14 16:13:10 2008
@@ -46,9 +46,9 @@
 void           gossip_jabber_chatrooms_send                (GossipJabberChatrooms *chatrooms,
 							    GossipChatroomId       id,
 							    const gchar           *message);
-void           gossip_jabber_chatrooms_change_topic        (GossipJabberChatrooms *chatrooms,
+void           gossip_jabber_chatrooms_change_subject      (GossipJabberChatrooms *chatrooms,
 							    GossipChatroomId       id,
-							    const gchar           *new_topic);
+							    const gchar           *new_subject);
 void           gossip_jabber_chatrooms_change_nick         (GossipJabberChatrooms *chatrooms,
 							    GossipChatroomId       id,
 							    const gchar           *new_nick);

Modified: trunk/libgossip/gossip-jabber.c
==============================================================================
--- trunk/libgossip/gossip-jabber.c	(original)
+++ trunk/libgossip/gossip-jabber.c	Wed May 14 16:13:10 2008
@@ -208,9 +208,9 @@
 static void             jabber_chatroom_send                (GossipChatroomProvider     *provider,
 							     GossipChatroomId            id,
 							     const gchar                *message);
-static void             jabber_chatroom_change_topic        (GossipChatroomProvider     *provider,
+static void             jabber_chatroom_change_subject      (GossipChatroomProvider     *provider,
 							     GossipChatroomId            id,
-							     const gchar                *new_topic);
+							     const gchar                *new_subject);
 static void             jabber_chatroom_change_nick         (GossipChatroomProvider     *provider,
 							     GossipChatroomId            id,
 							     const gchar                *new_nick);
@@ -2844,7 +2844,7 @@
 	iface->join            = jabber_chatroom_join;
 	iface->cancel          = jabber_chatroom_cancel;
 	iface->send            = jabber_chatroom_send;
-	iface->change_topic    = jabber_chatroom_change_topic;
+	iface->change_subject  = jabber_chatroom_change_subject;
 	iface->change_nick     = jabber_chatroom_change_nick;
 	iface->leave           = jabber_chatroom_leave;
 	iface->kick            = jabber_chatroom_kick;
@@ -2910,9 +2910,9 @@
 }
 
 static void
-jabber_chatroom_change_topic (GossipChatroomProvider *provider,
-			      GossipChatroomId        id,
-			      const gchar            *new_topic)
+jabber_chatroom_change_subject (GossipChatroomProvider *provider,
+				GossipChatroomId        id,
+				const gchar            *new_subject)
 {
 	GossipJabber     *jabber;
 	GossipJabberPriv *priv;
@@ -2922,7 +2922,7 @@
 	jabber = GOSSIP_JABBER (provider);
 	priv = GET_PRIV (jabber);
 
-	gossip_jabber_chatrooms_change_topic (priv->chatrooms, id, new_topic);
+	gossip_jabber_chatrooms_change_subject (priv->chatrooms, id, new_subject);
 }
 
 static void

Modified: trunk/src/gossip-chat-window.c
==============================================================================
--- trunk/src/gossip-chat-window.c	(original)
+++ trunk/src/gossip-chat-window.c	Wed May 14 16:13:10 2008
@@ -93,8 +93,8 @@
 	GtkWidget   *menu_room_join_new;
 	GtkWidget   *menu_room_invite;
 	GtkWidget   *menu_room_add;
-	GtkWidget   *menu_room_set_topic;
-	GtkWidget   *menu_room_set_nick;
+	GtkWidget   *menu_room_change_subject;
+	GtkWidget   *menu_room_change_nick;
 	GtkWidget   *menu_room_kick;
 	GtkWidget   *menu_room_show_contacts;
 
@@ -111,129 +111,129 @@
 	guint        save_geometry_id;
 };
 
-static void         gossip_chat_window_class_init              (GossipChatWindowClass *klass);
-static void         gossip_chat_window_init                    (GossipChatWindow      *window);
-static void         gossip_chat_window_finalize                (GObject               *object);
-static GdkPixbuf *  chat_window_get_status_pixbuf              (GossipChatWindow      *window,
-								GossipChat            *chat);
-static void         chat_window_accel_cb                       (GtkAccelGroup         *accelgroup,
-								GObject               *object,
-								guint                  key,
-								GdkModifierType        mod,
-								GossipChatWindow      *window);
-static void         chat_window_avatar_changed_cb              (GossipContact         *contact,
-								GParamSpec            *param,
-								GossipChatWindow      *window);
-static void         chat_window_close_clicked_cb               (GtkWidget             *button,
-								GossipChat            *chat);
-static GtkWidget *  chat_window_create_label                   (GossipChatWindow      *window,
-								GossipChat            *chat);
-static void         chat_window_update_status                  (GossipChatWindow      *window,
-								GossipChat            *chat);
-static void         chat_window_update_title                   (GossipChatWindow      *window,
-								GossipChat            *chat);
-static void         chat_window_update_menu                    (GossipChatWindow      *window);
-static gboolean     chat_window_save_geometry_timeout_cb       (GossipChatWindow      *window);
-static gboolean     chat_window_configure_event_cb             (GtkWidget             *widget,
-								GdkEventConfigure     *event,
-								GossipChatWindow      *window);
-static void         chat_window_conv_activate_cb               (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_conv_clear_activate_cb         (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_conv_info_activate_cb          (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_conv_email_activate_cb         (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_conv_add_contact_activate_cb   (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_conv_log_activate_cb           (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_conv_show_contacts_toggled_cb  (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_conv_close_activate_cb         (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_room_activate_cb               (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_room_join_new_activate_cb      (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_room_invite_activate_cb        (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_room_add_activate_cb           (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_room_set_topic_activate_cb     (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_room_set_nick_activate_cb      (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_room_kick_activate_cb          (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_edit_activate_cb               (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_edit_insert_smiley_activate_cb (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_edit_cut_activate_cb           (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_edit_copy_activate_cb          (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_edit_paste_activate_cb         (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_tabs_left_activate_cb          (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_tabs_right_activate_cb         (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static void         chat_window_tabs_detach_activate_cb        (GtkWidget             *menuitem,
-								GossipChatWindow      *window);
-static gboolean     chat_window_delete_event_cb                (GtkWidget             *dialog,
-								GdkEvent              *event,
-								GossipChatWindow      *window);
-static void         chat_window_status_changed_cb              (GossipChat            *chat,
-								GossipChatWindow      *window);
-static void         chat_window_update_tooltip                 (GossipChatWindow      *window,
-								GossipChat            *chat);
-static void         chat_window_name_changed_cb                (GossipChat            *chat,
-								const gchar           *name,
-								GossipChatWindow      *window);
-static void         chat_window_composing_cb                   (GossipChat            *chat,
-								gboolean               is_composing,
-								GossipChatWindow      *window);
-static void         chat_window_new_message_cb                 (GossipChat            *chat,
-								GossipMessage         *message,
-								gboolean               is_backlog,
-								GossipChatWindow      *window);
-static GtkNotebook* chat_window_detach_hook                    (GtkNotebook           *source,
-								GtkWidget             *page,
-								gint                   x,
-								gint                   y,
-								gpointer               user_data);
-static void         chat_window_page_switched_cb               (GtkNotebook           *notebook,
-								GtkNotebookPage       *page,
-								gint                   page_num,
-								GossipChatWindow      *window);
-static void         chat_window_page_reordered_cb              (GtkNotebook           *notebook,
-								GtkWidget             *widget,
-								guint                  page_num,
-								GossipChatWindow      *window);
-static void         chat_window_page_added_cb                  (GtkNotebook           *notebook,
-								GtkWidget             *child,
-								guint                  page_num,
-								GossipChatWindow      *window);
-static void         chat_window_page_removed_cb                (GtkNotebook           *notebook,
-								GtkWidget             *child,
-								guint                  page_num,
-								GossipChatWindow      *window);
-static gboolean     chat_window_focus_in_event_cb              (GtkWidget             *widget,
-								GdkEvent              *event,
-								GossipChatWindow      *window);
-static void         chat_window_drag_data_received             (GtkWidget             *widget,
-								GdkDragContext        *context,
-								int                    x,
-								int                    y,
-								GtkSelectionData      *selection,
-								guint                  info,
-								guint                  time,
-								GossipChatWindow      *window);
-static void         chat_window_set_urgency_hint               (GossipChatWindow      *window,
-								gboolean               urgent);
+static void         gossip_chat_window_class_init               (GossipChatWindowClass *klass);
+static void         gossip_chat_window_init                     (GossipChatWindow      *window);
+static void         gossip_chat_window_finalize                 (GObject               *object);
+static GdkPixbuf *  chat_window_get_status_pixbuf               (GossipChatWindow      *window,
+								 GossipChat            *chat);
+static void         chat_window_accel_cb                        (GtkAccelGroup         *accelgroup,
+								 GObject               *object,
+								 guint                  key,
+								 GdkModifierType        mod,
+								 GossipChatWindow      *window);
+static void         chat_window_avatar_changed_cb               (GossipContact         *contact,
+								 GParamSpec            *param,
+								 GossipChatWindow      *window);
+static void         chat_window_close_clicked_cb                (GtkWidget             *button,
+								 GossipChat            *chat);
+static GtkWidget *  chat_window_create_label                    (GossipChatWindow      *window,
+								 GossipChat            *chat);
+static void         chat_window_update_status                   (GossipChatWindow      *window,
+								 GossipChat            *chat);
+static void         chat_window_update_title                    (GossipChatWindow      *window,
+								 GossipChat            *chat);
+static void         chat_window_update_menu                     (GossipChatWindow      *window);
+static gboolean     chat_window_save_geometry_timeout_cb        (GossipChatWindow      *window);
+static gboolean     chat_window_configure_event_cb              (GtkWidget             *widget,
+								 GdkEventConfigure     *event,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_activate_cb                (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_clear_activate_cb          (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_info_activate_cb           (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_email_activate_cb          (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_add_contact_activate_cb    (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_log_activate_cb            (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_show_contacts_toggled_cb   (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_conv_close_activate_cb          (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_room_activate_cb                (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_room_join_new_activate_cb       (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_room_invite_activate_cb         (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_room_add_activate_cb            (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_room_change_subject_activate_cb (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_room_change_nick_activate_cb    (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_room_kick_activate_cb           (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_edit_activate_cb                (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_edit_insert_smiley_activate_cb  (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_edit_cut_activate_cb            (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_edit_copy_activate_cb           (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_edit_paste_activate_cb          (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_tabs_left_activate_cb           (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_tabs_right_activate_cb          (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static void         chat_window_tabs_detach_activate_cb         (GtkWidget             *menuitem,
+								 GossipChatWindow      *window);
+static gboolean     chat_window_delete_event_cb                 (GtkWidget             *dialog,
+								 GdkEvent              *event,
+								 GossipChatWindow      *window);
+static void         chat_window_status_changed_cb               (GossipChat            *chat,
+								 GossipChatWindow      *window);
+static void         chat_window_update_tooltip                  (GossipChatWindow      *window,
+								 GossipChat            *chat);
+static void         chat_window_name_changed_cb                 (GossipChat            *chat,
+								 const gchar           *name,
+								 GossipChatWindow      *window);
+static void         chat_window_composing_cb                    (GossipChat            *chat,
+								 gboolean               is_composing,
+								 GossipChatWindow      *window);
+static void         chat_window_new_message_cb                  (GossipChat            *chat,
+								 GossipMessage         *message,
+								 gboolean               is_backlog,
+								 GossipChatWindow      *window);
+static GtkNotebook* chat_window_detach_hook                     (GtkNotebook           *source,
+								 GtkWidget             *page,
+								 gint                   x,
+								 gint                   y,
+								 gpointer               user_data);
+static void         chat_window_page_switched_cb                (GtkNotebook           *notebook,
+								 GtkNotebookPage       *page,
+								 gint                   page_num,
+								 GossipChatWindow      *window);
+static void         chat_window_page_reordered_cb               (GtkNotebook           *notebook,
+								 GtkWidget             *widget,
+								 guint                  page_num,
+								 GossipChatWindow      *window);
+static void         chat_window_page_added_cb                   (GtkNotebook           *notebook,
+								 GtkWidget             *child,
+								 guint                  page_num,
+								 GossipChatWindow      *window);
+static void         chat_window_page_removed_cb                 (GtkNotebook           *notebook,
+								 GtkWidget             *child,
+								 guint                  page_num,
+								 GossipChatWindow      *window);
+static gboolean     chat_window_focus_in_event_cb               (GtkWidget             *widget,
+								 GdkEvent              *event,
+								 GossipChatWindow      *window);
+static void         chat_window_drag_data_received              (GtkWidget             *widget,
+								 GdkDragContext        *context,
+								 int                    x,
+								 int                    y,
+								 GtkSelectionData      *selection,
+								 guint                  info,
+								 guint                  time,
+								 GossipChatWindow      *window);
+static void         chat_window_set_urgency_hint                (GossipChatWindow      *window,
+								 gboolean               urgent);
 
 static GList *chat_windows = NULL;
 
@@ -313,8 +313,8 @@
 				       "menu_room_join_new", &priv->menu_room_join_new,
 				       "menu_room_invite", &priv->menu_room_invite,
 				       "menu_room_add", &priv->menu_room_add,
-				       "menu_room_set_topic", &priv->menu_room_set_topic,
-				       "menu_room_set_nick", &priv->menu_room_set_nick,
+				       "menu_room_change_subject", &priv->menu_room_change_subject,
+				       "menu_room_change_nick", &priv->menu_room_change_nick,
 				       "menu_room_kick", &priv->menu_room_kick,
 				       "menu_room_show_contacts", &priv->menu_room_show_contacts,
 				       "menu_edit_cut", &priv->menu_edit_cut,
@@ -341,8 +341,8 @@
 			      "menu_room_join_new", "activate", chat_window_room_join_new_activate_cb,
 			      "menu_room_invite", "activate", chat_window_room_invite_activate_cb,
 			      "menu_room_add", "activate", chat_window_room_add_activate_cb,
-			      "menu_room_set_topic", "activate", chat_window_room_set_topic_activate_cb,
-			      "menu_room_set_nick", "activate", chat_window_room_set_nick_activate_cb,
+			      "menu_room_change_subject", "activate", chat_window_room_change_subject_activate_cb,
+			      "menu_room_change_nick", "activate", chat_window_room_change_nick_activate_cb,
 			      "menu_room_kick", "activate", chat_window_room_kick_activate_cb,
 			      "menu_edit", "activate", chat_window_edit_activate_cb,
 			      "menu_edit_cut", "activate", chat_window_edit_cut_activate_cb,
@@ -841,6 +841,8 @@
 		GossipChatroom        *chatroom;
 		GossipChatroomId       id;
 		gboolean               saved;
+		gboolean               can_kick = TRUE;
+		gboolean               can_change_subject = TRUE;
 
 		group_chat = GOSSIP_GROUP_CHAT (priv->current_chat);
 		chatroom = gossip_group_chat_get_chatroom (group_chat);
@@ -859,12 +861,19 @@
 		id = gossip_chatroom_get_id (chatroom);
 		saved = gossip_chatroom_manager_find (manager, id) != NULL;
 
+		can_kick &= is_connected;
+		can_kick &= gossip_group_chat_contact_can_kick (group_chat, own_contact);
+
+		can_change_subject &= is_connected;
+		can_change_subject &= gossip_group_chat_contact_can_change_subject (group_chat, own_contact);
+
 		gtk_widget_set_sensitive (priv->menu_room_add, !saved);
 		gtk_widget_set_sensitive (priv->menu_conv_insert_smiley, is_connected);
 		gtk_widget_set_sensitive (priv->menu_room_join_new, is_connected);
 		gtk_widget_set_sensitive (priv->menu_room_invite, is_connected);
-		gtk_widget_set_sensitive (priv->menu_room_set_topic, is_connected);
-		gtk_widget_set_sensitive (priv->menu_room_set_nick, is_connected);
+		gtk_widget_set_sensitive (priv->menu_room_change_subject, can_change_subject);
+		gtk_widget_set_sensitive (priv->menu_room_change_nick, is_connected);
+		gtk_widget_set_sensitive (priv->menu_room_kick, can_kick);
 
 		/* We need to block the signal here because all we are
 		 * really trying to do is check or uncheck the menu
@@ -1123,6 +1132,7 @@
 	GossipContact        *contact;
 	GossipContact        *own_contact;
 	gboolean              can_kick;
+	gboolean              can_change_subject;
 
 	priv = GET_PRIV (window);
 
@@ -1137,8 +1147,14 @@
 
 	can_kick  = TRUE;
 	can_kick &= contact && !gossip_contact_equal (contact, own_contact);
+	can_kick &= gossip_group_chat_contact_can_kick (group_chat, own_contact);
 
 	gtk_widget_set_sensitive (priv->menu_room_kick, can_kick);
+
+	can_change_subject = TRUE;
+	can_change_subject &= gossip_group_chat_contact_can_change_subject (group_chat, own_contact);
+
+	gtk_widget_set_sensitive (priv->menu_room_change_subject, can_change_subject);
 }
 
 static void
@@ -1203,8 +1219,8 @@
 }
 
 static void
-chat_window_room_set_topic_activate_cb (GtkWidget        *menuitem,
-					GossipChatWindow *window)
+chat_window_room_change_subject_activate_cb (GtkWidget        *menuitem,
+					     GossipChatWindow *window)
 {
 	GossipChatWindowPriv *priv;
 	GossipGroupChat      *group_chat;
@@ -1216,12 +1232,12 @@
 	}
 
 	group_chat = GOSSIP_GROUP_CHAT (priv->current_chat);
-	gossip_group_chat_set_topic (group_chat);
+	gossip_group_chat_change_subject (group_chat);
 }
 
 static void
-chat_window_room_set_nick_activate_cb (GtkWidget        *menuitem,
-				       GossipChatWindow *window)
+chat_window_room_change_nick_activate_cb (GtkWidget        *menuitem,
+					  GossipChatWindow *window)
 {
 	GossipChatWindowPriv *priv;
 	GossipGroupChat      *group_chat;
@@ -1233,7 +1249,7 @@
 	}
 
 	group_chat = GOSSIP_GROUP_CHAT (priv->current_chat);
-	gossip_group_chat_set_nick (group_chat);
+	gossip_group_chat_change_nick (group_chat);
 }
 
 static void
@@ -1250,7 +1266,7 @@
 	}
 
 	group_chat = GOSSIP_GROUP_CHAT (priv->current_chat);
-	gossip_group_chat_kick (group_chat, NULL);
+	gossip_group_chat_contact_kick (group_chat, NULL);
 }
 
 static void

Modified: trunk/src/gossip-chat.c
==============================================================================
--- trunk/src/gossip-chat.c	(original)
+++ trunk/src/gossip-chat.c	Wed May 14 16:13:10 2008
@@ -707,7 +707,8 @@
 	else if (g_str_has_prefix (str, "/nick")) {
 		return TRUE;
 	}
-	else if (g_str_has_prefix (str, "/topic")) {
+	else if (g_str_has_prefix (str, "/subject") || 
+		 g_str_has_prefix (str, "/topic")) {
 		return TRUE;
 	}
 

Modified: trunk/src/gossip-group-chat.c
==============================================================================
--- trunk/src/gossip-group-chat.c	(original)
+++ trunk/src/gossip-group-chat.c	Wed May 14 16:13:10 2008
@@ -71,9 +71,9 @@
 	GtkWidget              *scrolled_window_input;
 	GtkWidget              *scrolled_window_contacts;
 
-	GtkWidget              *hbox_topic;
-	GtkWidget              *label_topic;
-	gchar                  *topic;
+	GtkWidget              *hbox_subject;
+	GtkWidget              *label_subject;
+	gchar                  *subject;
 
 	GtkWidget              *treeview;
 
@@ -158,10 +158,10 @@
 							       gint                          id,
 							       const gchar                  *event,
 							       GossipGroupChat              *chat);
-static void            group_chat_topic_changed_cb            (GossipChatroomProvider       *provider,
+static void            group_chat_subject_changed_cb          (GossipChatroomProvider       *provider,
 							       gint                          id,
 							       GossipContact                *who,
-							       const gchar                  *new_topic,
+							       const gchar                  *new_subject,
 							       GossipGroupChat              *chat);
 static void            group_chat_error_cb                    (GossipChatroomProvider       *provider,
 							       GossipChatroomId              id,
@@ -374,7 +374,7 @@
 					      group_chat_new_event_cb,
 					      chat);
 	g_signal_handlers_disconnect_by_func (priv->chatroom_provider,
-					      group_chat_topic_changed_cb,
+					      group_chat_subject_changed_cb,
 					      chat);
 	g_signal_handlers_disconnect_by_func (priv->chatroom_provider,
 					      group_chat_error_cb,
@@ -410,7 +410,7 @@
 	
 	g_object_unref (priv->chatroom_provider);
 
-	g_free (priv->topic);
+	g_free (priv->subject);
 
 	g_list_foreach (priv->private_chats,
 			(GFunc) group_chat_private_chat_stop_foreach,
@@ -484,7 +484,7 @@
 	priv->last_status = status;
 
 	/* Make widgets available based on state */
-	gtk_widget_set_sensitive (priv->hbox_topic, 
+	gtk_widget_set_sensitive (priv->hbox_subject, 
 				  status == GOSSIP_CHATROOM_STATUS_ACTIVE);
 	gtk_widget_set_sensitive (priv->scrolled_window_contacts, 
 				  status == GOSSIP_CHATROOM_STATUS_ACTIVE);
@@ -886,28 +886,28 @@
 				     "border-width", 4,
 				     NULL);
 
-	priv->hbox_topic = gtk_hbox_new (FALSE, 6);
+	priv->hbox_subject = gtk_hbox_new (FALSE, 6);
 
-	gtk_box_pack_start (GTK_BOX (priv->widget), priv->hbox_topic,
+	gtk_box_pack_start (GTK_BOX (priv->widget), priv->hbox_subject,
 			    FALSE, FALSE, 2);
 
 	temp_widget = g_object_new (GTK_TYPE_LABEL,
-				    "label", _("<b>Topic:</b>"),
+				    "label", _("<b>Subject:</b>"),
 				    "use-markup", TRUE,
 				    NULL);
 
-	gtk_box_pack_start (GTK_BOX (priv->hbox_topic), temp_widget,
+	gtk_box_pack_start (GTK_BOX (priv->hbox_subject), temp_widget,
 			    FALSE, FALSE, 0);
 
-	priv->label_topic = g_object_new (GTK_TYPE_LABEL,
-					  "use-markup", TRUE,
-					  "single-line-mode", TRUE,
-					  "ellipsize", PANGO_ELLIPSIZE_END,
-					  "selectable", TRUE,
-					  "xalign", 0.0,
-					  NULL);
+	priv->label_subject = g_object_new (GTK_TYPE_LABEL,
+					    "use-markup", TRUE,
+					    "single-line-mode", TRUE,
+					    "ellipsize", PANGO_ELLIPSIZE_END,
+					    "selectable", TRUE,
+					    "xalign", 0.0,
+					    NULL);
 
-	gtk_box_pack_start (GTK_BOX (priv->hbox_topic), priv->label_topic,
+	gtk_box_pack_start (GTK_BOX (priv->hbox_subject), priv->label_subject,
 			    TRUE, TRUE, 0);
 
 	priv->hpaned = gtk_hpaned_new ();
@@ -1018,7 +1018,7 @@
 	g_list_free (list);
 
 	list = g_list_append (NULL, priv->hpaned);
-	list = g_list_append (list, priv->hbox_topic);
+	list = g_list_append (list, priv->hbox_subject);
 	gtk_container_set_focus_chain (GTK_CONTAINER (priv->widget), list);
 	g_list_free (list);
 }
@@ -1096,7 +1096,7 @@
 
 	chatview = GOSSIP_CHAT (chat)->view;
 
-	gtk_widget_set_sensitive (priv->hbox_topic, FALSE);
+	gtk_widget_set_sensitive (priv->hbox_subject, FALSE);
 	gtk_widget_set_sensitive (priv->scrolled_window_contacts, FALSE);
 	gtk_widget_set_sensitive (priv->scrolled_window_input, FALSE);
 	
@@ -1207,10 +1207,10 @@
 }
 
 static void
-group_chat_topic_changed_cb (GossipChatroomProvider *provider,
+group_chat_subject_changed_cb (GossipChatroomProvider *provider,
 			     gint                    id,
 			     GossipContact          *who,
-			     const gchar            *new_topic,
+			     const gchar            *new_subject,
 			     GossipGroupChat        *chat)
 {
 	GossipGroupChatPriv *priv;
@@ -1222,17 +1222,17 @@
 		return;
 	}
 
-	gossip_debug (DEBUG_DOMAIN, "[%d] Topic changed by:'%s' to:'%s'",
-		      id, gossip_contact_get_id (who), new_topic);
+	gossip_debug (DEBUG_DOMAIN, "[%d] Subject changed by:'%s' to:'%s'",
+		      id, gossip_contact_get_id (who), new_subject);
 
-	g_free (priv->topic);
-	priv->topic = g_strdup (new_topic);
+	g_free (priv->subject);
+	priv->subject = g_strdup (new_subject);
 	
-	gtk_label_set_text (GTK_LABEL (priv->label_topic), new_topic);
+	gtk_label_set_text (GTK_LABEL (priv->label_subject), new_subject);
 
-	event = g_strdup_printf (_("%s has set the topic: %s"),
+	event = g_strdup_printf (_("%s has set the subject: %s"),
 				 gossip_contact_get_name (who),
-				 new_topic);
+				 new_subject);
 
 	group_chat_set_scrolling_for_events (chat, TRUE);
 	gossip_chat_view_append_event (GOSSIP_CHAT (chat)->view, event);
@@ -1296,10 +1296,10 @@
 
 				priv = GET_PRIV (chat);
 
-				if (strcmp (purpose, "change-topic") == 0) {
-					gossip_chatroom_provider_change_topic (priv->chatroom_provider,
-									       gossip_chatroom_get_id (priv->chatroom),
-									       str);
+				if (strcmp (purpose, "change-subject") == 0) {
+					gossip_chatroom_provider_change_subject (priv->chatroom_provider,
+										 gossip_chatroom_get_id (priv->chatroom),
+										 str);
 				}
 				else if (strcmp (purpose, "change-nick") == 0) {
 					gossip_chatroom_provider_change_nick (priv->chatroom_provider,
@@ -1398,69 +1398,6 @@
 	return contact;
 }
 
-void
-gossip_group_chat_set_topic (GossipGroupChat *group_chat)
-{
-	GossipGroupChatPriv *priv;
-
-	g_return_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat));
-
-	priv = GET_PRIV (group_chat);
-
-	group_chat_dialog_new (group_chat, 
-			       "change-topic", 
-			       _("Enter the new topic you want to set for this room:"),
-			       gtk_label_get_text (GTK_LABEL (priv->label_topic)));
-
-}
-
-void
-gossip_group_chat_set_nick (GossipGroupChat *group_chat)
-{
-	GossipGroupChatPriv *priv;
-
-	g_return_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat));
-
-	priv = GET_PRIV (group_chat);
-
-	group_chat_dialog_new (group_chat, 
-			       "change-nick", 
-			       _("Enter the new nickname you want to be known by:"),
-			       gossip_chatroom_get_nick (priv->chatroom));
-}
-
-void
-gossip_group_chat_kick (GossipGroupChat *group_chat,
-			GossipContact   *contact)
-{
-	GossipGroupChatPriv *priv;
-	GossipContact       *contact_to_kick = NULL;
-	gchar               *str;
-
-	g_return_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat));
-
-	priv = GET_PRIV (group_chat);
-
-	if (contact) {
-		contact_to_kick = contact;
-	} else {
-		contact_to_kick = gossip_group_chat_get_selected_contact (group_chat);
-	}
-
-	g_return_if_fail (contact_to_kick != NULL);
-
-	str = g_strdup_printf (_("Kicking %s"), 
-			       gossip_contact_get_name (contact_to_kick)); 
-	gossip_chat_view_append_event (GOSSIP_CHAT (group_chat)->view, str);
-	g_free (str);
-
-	gossip_chatroom_provider_kick (priv->chatroom_provider,
-				       gossip_chatroom_get_id (priv->chatroom),
-				       contact_to_kick,
-				       _("You have been removed from the "
-					 "room by an administrator."));
-}
-
 static void
 group_chat_cl_row_activated_cb (GtkTreeView       *view,
 				GtkTreePath       *path,
@@ -2126,7 +2063,7 @@
 		}
 		
 		if (contact) {
-			gossip_group_chat_kick (chat, contact);
+			gossip_group_chat_contact_kick (chat, contact);
 		} else {
 			gossip_chat_view_append_event (GOSSIP_CHAT (chat)->view, 
 						       _("Nick was not recogized"));
@@ -2134,13 +2071,22 @@
 
 		handled_command = TRUE;
 	}
+	else if (g_ascii_strncasecmp (msg, "/subject ", 9) == 0 && strlen (msg) > 9) {
+		const gchar *subject;
+		
+		subject = msg + 9;
+		gossip_chatroom_provider_change_subject (priv->chatroom_provider,
+							 gossip_chatroom_get_id (priv->chatroom),
+							 subject);
+		handled_command = TRUE;
+	}
 	else if (g_ascii_strncasecmp (msg, "/topic ", 7) == 0 && strlen (msg) > 7) {
-		const gchar *topic;
-
-		topic = msg + 7;
-		gossip_chatroom_provider_change_topic (priv->chatroom_provider,
-						       gossip_chatroom_get_id (priv->chatroom),
-						       topic);
+		const gchar *subject;
+		
+		subject = msg + 7;
+		gossip_chatroom_provider_change_subject (priv->chatroom_provider,
+							 gossip_chatroom_get_id (priv->chatroom),
+							 subject);
 		handled_command = TRUE;
 	}
 	else if (g_ascii_strcasecmp (msg, "/clear") == 0) {
@@ -2247,15 +2193,15 @@
 	group_chat = GOSSIP_GROUP_CHAT (chat);
 	priv = GET_PRIV (group_chat);
 
-	if (priv->topic) {
-		gchar *topic;
+	if (priv->subject) {
+		gchar *subject;
 		gchar *tooltip;
 
-		topic = g_strdup_printf (_("Topic: %s"), priv->topic);
+		subject = g_strdup_printf (_("Subject: %s"), priv->subject);
 		tooltip = g_strdup_printf ("%s\n%s", 
 					   gossip_chatroom_get_name (priv->chatroom), 
-					   topic);
-		g_free (topic);
+					   subject);
+		g_free (subject);
 
 		return tooltip;
 	}
@@ -2544,8 +2490,8 @@
 	g_signal_connect (provider, "chatroom-new-event",
 			  G_CALLBACK (group_chat_new_event_cb),
 			  chat);
-	g_signal_connect (provider, "chatroom-topic-changed",
-			  G_CALLBACK (group_chat_topic_changed_cb),
+	g_signal_connect (provider, "chatroom-subject-changed",
+			  G_CALLBACK (group_chat_subject_changed_cb),
 			  chat);
 	g_signal_connect (provider, "chatroom-error",
 			  G_CALLBACK (group_chat_error_cb),
@@ -2617,3 +2563,147 @@
 
 	return priv->chatroom;
 }
+
+
+void
+gossip_group_chat_change_subject (GossipGroupChat *group_chat)
+{
+	GossipGroupChatPriv *priv;
+
+	g_return_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat));
+
+	priv = GET_PRIV (group_chat);
+
+	group_chat_dialog_new (group_chat, 
+			       "change-subject", 
+			       _("Enter the new subject you want to set for this room:"),
+			       gtk_label_get_text (GTK_LABEL (priv->label_subject)));
+
+}
+
+void
+gossip_group_chat_change_nick (GossipGroupChat *group_chat)
+{
+	GossipGroupChatPriv *priv;
+
+	g_return_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat));
+
+	priv = GET_PRIV (group_chat);
+
+	group_chat_dialog_new (group_chat, 
+			       "change-nick", 
+			       _("Enter the new nickname you want to be known by:"),
+			       gossip_chatroom_get_nick (priv->chatroom));
+}
+
+void
+gossip_group_chat_contact_kick (GossipGroupChat *group_chat,
+				GossipContact   *contact)
+{
+	GossipGroupChatPriv *priv;
+	GossipContact       *contact_to_kick;
+	gchar               *str;
+
+	g_return_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat));
+
+	priv = GET_PRIV (group_chat);
+
+	if (contact) {
+		contact_to_kick = contact;
+	} else {
+		contact_to_kick = gossip_group_chat_get_selected_contact (group_chat);
+	}
+
+	g_return_if_fail (contact_to_kick != NULL);
+
+	str = g_strdup_printf (_("Kicking %s"), 
+			       gossip_contact_get_name (contact_to_kick)); 
+	gossip_chat_view_append_event (GOSSIP_CHAT (group_chat)->view, str);
+	g_free (str);
+
+	gossip_chatroom_provider_kick (priv->chatroom_provider,
+				       gossip_chatroom_get_id (priv->chatroom),
+				       contact_to_kick,
+				       _("You have been removed from the "
+					 "room by an administrator."));
+}
+
+gboolean
+gossip_group_chat_contact_can_message_all (GossipGroupChat *group_chat,
+					   GossipContact   *contact)
+{
+	GossipGroupChatPriv *priv;
+	GossipContact       *contact_to_use;
+
+	g_return_val_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat), FALSE);
+
+	priv = GET_PRIV (group_chat);
+
+	if (contact) {
+		contact_to_use = contact;
+	} else {
+		contact_to_use = gossip_group_chat_get_selected_contact (group_chat);
+	}
+
+	return gossip_chatroom_contact_can_message_all (priv->chatroom, contact_to_use);
+}
+
+gboolean
+gossip_group_chat_contact_can_change_subject (GossipGroupChat *group_chat,
+					      GossipContact   *contact)
+{
+	GossipGroupChatPriv *priv;
+	GossipContact       *contact_to_use;
+
+	g_return_val_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat), FALSE);
+
+	priv = GET_PRIV (group_chat);
+
+	if (contact) {
+		contact_to_use = contact;
+	} else {
+		contact_to_use = gossip_group_chat_get_selected_contact (group_chat);
+	}
+
+	return gossip_chatroom_contact_can_change_subject (priv->chatroom, contact_to_use);
+}
+
+gboolean
+gossip_group_chat_contact_can_kick (GossipGroupChat *group_chat,
+				    GossipContact   *contact)
+{
+	GossipGroupChatPriv *priv;
+	GossipContact       *contact_to_use;
+
+	g_return_val_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat), FALSE);
+
+	priv = GET_PRIV (group_chat);
+
+	if (contact) {
+		contact_to_use = contact;
+	} else {
+		contact_to_use = gossip_group_chat_get_selected_contact (group_chat);
+	}
+
+	return gossip_chatroom_contact_can_kick (priv->chatroom, contact_to_use);
+}
+
+gboolean
+gossip_group_chat_contact_can_change_role (GossipGroupChat *group_chat,
+					   GossipContact   *contact)
+{
+	GossipGroupChatPriv *priv;
+	GossipContact       *contact_to_use;
+
+	g_return_val_if_fail (GOSSIP_IS_GROUP_CHAT (group_chat), FALSE);
+
+	priv = GET_PRIV (group_chat);
+
+	if (contact) {
+		contact_to_use = contact;
+	} else {
+		contact_to_use = gossip_group_chat_get_selected_contact (group_chat);
+	}
+
+	return gossip_chatroom_contact_can_change_role (priv->chatroom, contact_to_use);
+}

Modified: trunk/src/gossip-group-chat.h
==============================================================================
--- trunk/src/gossip-group-chat.h	(original)
+++ trunk/src/gossip-group-chat.h	Wed May 14 16:13:10 2008
@@ -53,18 +53,31 @@
 	GossipChatClass parent_class;
 };
 
-GType            gossip_group_chat_get_type              (void) G_GNUC_CONST;
-GossipGroupChat *gossip_group_chat_new                   (GossipChatroomProvider *provider,
-							  GossipChatroom         *chatroom);
-GossipChatroomId gossip_group_chat_get_chatroom_id       (GossipGroupChat        *group_chat);
+GType            gossip_group_chat_get_type                   (void) G_GNUC_CONST;
+GossipGroupChat *gossip_group_chat_new                        (GossipChatroomProvider *provider,
+							       GossipChatroom         *chatroom);
+GossipChatroomId gossip_group_chat_get_chatroom_id            (GossipGroupChat        *group_chat);
 GossipChatroomProvider *
-		 gossip_group_chat_get_chatroom_provider (GossipGroupChat        *group_chat);
-GossipChatroom * gossip_group_chat_get_chatroom          (GossipGroupChat        *group_chat);
-GossipContact *  gossip_group_chat_get_selected_contact  (GossipGroupChat        *group_chat);
-void             gossip_group_chat_set_topic             (GossipGroupChat        *group_chat);
-void             gossip_group_chat_set_nick              (GossipGroupChat        *group_chat);
-void             gossip_group_chat_kick                  (GossipGroupChat        *group_chat,
-							  GossipContact          *contact);
+		 gossip_group_chat_get_chatroom_provider      (GossipGroupChat        *group_chat);
+GossipChatroom * gossip_group_chat_get_chatroom               (GossipGroupChat        *group_chat);
+GossipContact *  gossip_group_chat_get_selected_contact       (GossipGroupChat        *group_chat);
+
+/* Actions */
+void             gossip_group_chat_change_subject             (GossipGroupChat        *group_chat);
+void             gossip_group_chat_change_nick                (GossipGroupChat        *group_chat);
+void             gossip_group_chat_contact_kick               (GossipGroupChat        *group_chat,
+							       GossipContact          *contact);
+
+
+/* Privileges */
+gboolean         gossip_group_chat_contact_can_message_all    (GossipGroupChat        *group_chat,
+							       GossipContact          *contact);
+gboolean         gossip_group_chat_contact_can_change_subject (GossipGroupChat        *group_chat,
+							       GossipContact          *contact);
+gboolean         gossip_group_chat_contact_can_kick           (GossipGroupChat        *group_chat,
+							       GossipContact          *contact);
+gboolean         gossip_group_chat_contact_can_change_role    (GossipGroupChat        *group_chat,
+							       GossipContact          *contact);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]