aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-04-07 09:41:54 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-04-08 08:55:12 +0800
commit97f0e63fecc9e5639417f9cdbb216278a48d2aa3 (patch)
treec18bde959a03fe6b84538b9e1898267eea01a4f4
parentcc7f77f31bd42f816dad43e811fb17264b4a756e (diff)
downloadgsoc2013-empathy-97f0e63fecc9e5639417f9cdbb216278a48d2aa3.tar
gsoc2013-empathy-97f0e63fecc9e5639417f9cdbb216278a48d2aa3.tar.gz
gsoc2013-empathy-97f0e63fecc9e5639417f9cdbb216278a48d2aa3.tar.bz2
gsoc2013-empathy-97f0e63fecc9e5639417f9cdbb216278a48d2aa3.tar.lz
gsoc2013-empathy-97f0e63fecc9e5639417f9cdbb216278a48d2aa3.tar.xz
gsoc2013-empathy-97f0e63fecc9e5639417f9cdbb216278a48d2aa3.tar.zst
gsoc2013-empathy-97f0e63fecc9e5639417f9cdbb216278a48d2aa3.zip
Add sms-channel property to empathy-chat
-rw-r--r--libempathy-gtk/empathy-chat.c46
-rw-r--r--libempathy-gtk/empathy-chat.h1
2 files changed, 45 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index e6eca0906..32c79eb04 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -144,6 +144,7 @@ struct _EmpathyChatPriv {
* notified again about the already notified pending messages when the
* messages in tab will be properly shown */
gboolean retrieving_backlogs;
+ gboolean sms_channel;
};
typedef struct {
@@ -168,6 +169,7 @@ enum {
PROP_SUBJECT,
PROP_REMOTE_CONTACT,
PROP_SHOW_CONTACTS,
+ PROP_SMS_CHANNEL,
};
static guint signals[LAST_SIGNAL] = { 0 };
@@ -205,6 +207,9 @@ chat_get_property (GObject *object,
case PROP_SHOW_CONTACTS:
g_value_set_boolean (value, priv->show_contacts);
break;
+ case PROP_SMS_CHANNEL:
+ g_value_set_boolean (value, priv->sms_channel);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -245,8 +250,14 @@ account_reconnected (EmpathyChat *chat,
* https://bugs.freedesktop.org/show_bug.cgi?id=13422 */
switch (priv->handle_type) {
case TP_HANDLE_TYPE_CONTACT:
- empathy_dispatcher_chat_with_contact_id (
- account, priv->id, TP_USER_ACTION_TIME_NOT_USER_ACTION);
+ if (priv->sms_channel)
+ empathy_dispatcher_sms_contact_id (
+ account, priv->id,
+ TP_USER_ACTION_TIME_NOT_USER_ACTION);
+ else
+ empathy_dispatcher_chat_with_contact_id (
+ account, priv->id,
+ TP_USER_ACTION_TIME_NOT_USER_ACTION);
break;
case TP_HANDLE_TYPE_ROOM:
empathy_dispatcher_join_muc (account, priv->id,
@@ -2762,6 +2773,14 @@ empathy_chat_class_init (EmpathyChatClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_SMS_CHANNEL,
+ g_param_spec_boolean ("sms-channel",
+ "SMS Channel",
+ "TRUE if this channel is for sending SMSes",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
signals[COMPOSING] =
g_signal_new ("composing",
G_OBJECT_CLASS_TYPE (object_class),
@@ -3029,6 +3048,15 @@ chat_password_needed_changed_cb (EmpathyChat *self)
}
}
+static void
+chat_sms_channel_changed_cb (EmpathyChat *self)
+{
+ EmpathyChatPriv *priv = GET_PRIV (self);
+
+ priv->sms_channel = empathy_tp_chat_is_sms_channel (priv->tp_chat);
+ g_object_notify (G_OBJECT (self), "sms-channel");
+}
+
void
empathy_chat_set_tp_chat (EmpathyChat *chat,
EmpathyTpChat *tp_chat)
@@ -3080,6 +3108,9 @@ empathy_chat_set_tp_chat (EmpathyChat *chat,
g_signal_connect_swapped (tp_chat, "notify::password-needed",
G_CALLBACK (chat_password_needed_changed_cb),
chat);
+ g_signal_connect_swapped (tp_chat, "notify::sms-channel",
+ G_CALLBACK (chat_sms_channel_changed_cb),
+ chat);
/* Get initial value of properties */
properties = empathy_tp_chat_get_properties (priv->tp_chat);
@@ -3100,6 +3131,7 @@ empathy_chat_set_tp_chat (EmpathyChat *chat,
}
}
+ chat_sms_channel_changed_cb (chat);
chat_remote_contact_changed_cb (chat);
if (chat->input_text_view) {
@@ -3356,3 +3388,13 @@ empathy_chat_messages_read (EmpathyChat *self)
}
priv->unread_messages = 0;
}
+
+gboolean
+empathy_chat_is_sms_channel (EmpathyChat *self)
+{
+ EmpathyChatPriv *priv = GET_PRIV (self);
+
+ g_return_val_if_fail (EMPATHY_IS_CHAT (self), 0);
+
+ return priv->sms_channel;
+}
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 596b83f5d..c111133de 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -89,6 +89,7 @@ void empathy_chat_set_show_contacts (EmpathyChat *chat,
guint empathy_chat_get_nb_unread_messages (EmpathyChat *chat);
void empathy_chat_messages_read (EmpathyChat *self);
+gboolean empathy_chat_is_sms_channel (EmpathyChat *self);
G_END_DECLS
#endif /* __EMPATHY_CHAT_H__ */