[Telepathy-commits] [telepathy-gabble/master] GabbleMucChannel: add the Requested property

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 19 10:53:52 PDT 2008


20080722163118-53eee-2082d2b6124096b8fbc5ab6c7ad338fc7f9d26a3.gz
---
 src/muc-channel.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/src/muc-channel.c b/src/muc-channel.c
index 2dfe94b..f9e6176 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -104,6 +104,7 @@ enum
   PROP_HANDLE_TYPE,
   PROP_HANDLE,
   PROP_TARGET_ID,
+  PROP_REQUESTED,
   PROP_CONNECTION,
   PROP_STATE,
   PROP_INVITE_SELF,
@@ -782,6 +783,7 @@ gabble_muc_channel_get_property (GObject    *object,
 {
   GabbleMucChannel *chan = GABBLE_MUC_CHANNEL (object);
   GabbleMucChannelPrivate *priv = GABBLE_MUC_CHANNEL_GET_PRIVATE (chan);
+  TpBaseConnection *base_conn = (TpBaseConnection *) priv->conn;
 
   switch (property_id) {
     case PROP_OBJECT_PATH:
@@ -816,13 +818,16 @@ gabble_muc_channel_get_property (GObject    *object,
     case PROP_INITIATOR_ID:
         {
           TpHandleRepoIface *repo = tp_base_connection_get_handles (
-              (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
+              base_conn, TP_HANDLE_TYPE_CONTACT);
 
           g_assert (priv->initiator != 0);
           g_value_set_string (value,
               tp_handle_inspect (repo, priv->initiator));
         }
       break;
+    case PROP_REQUESTED:
+      g_value_set_boolean (value, (priv->initiator == base_conn->self_handle));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -904,6 +909,7 @@ gabble_muc_channel_class_init (GabbleMucChannelClass *gabble_muc_channel_class)
       { NULL }
   };
   static TpDBusPropertiesMixinPropImpl future_props[] = {
+      { "Requested", "requested", NULL },
       { "TargetID", "target-id", NULL },
       { "InitiatorHandle", "initiator-handle", NULL },
       { "InitiatorID", "initiator-id", NULL },
@@ -1000,6 +1006,13 @@ gabble_muc_channel_class_init (GabbleMucChannelClass *gabble_muc_channel_class)
   g_object_class_install_property (object_class, PROP_INITIATOR_ID,
       param_spec);
 
+  param_spec = g_param_spec_boolean ("requested", "Requested?",
+      "True if this channel was requested by the local user",
+      FALSE,
+      G_PARAM_READABLE |
+      G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME);
+  g_object_class_install_property (object_class, PROP_REQUESTED, param_spec);
+
   param_spec = g_param_spec_string ("invitation-message",
       "Invitation message",
       "The message we were sent when invited; NULL if not invited or if "
-- 
1.5.6.3




More information about the Telepathy-commits mailing list