aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-message.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2009-08-31 08:15:41 +0800
committerWill Thompson <will.thompson@collabora.co.uk>2009-08-31 08:18:14 +0800
commitad59f77dfdba77af558ae2d278c92b0a7ab747d7 (patch)
tree7f219c54bdf97c7e206d155ec307e8068dd14246 /libempathy/empathy-message.c
parent2150f8ae4242fe2a26f29c96ddeb27ace1fe90fd (diff)
downloadgsoc2013-empathy-ad59f77dfdba77af558ae2d278c92b0a7ab747d7.tar
gsoc2013-empathy-ad59f77dfdba77af558ae2d278c92b0a7ab747d7.tar.gz
gsoc2013-empathy-ad59f77dfdba77af558ae2d278c92b0a7ab747d7.tar.bz2
gsoc2013-empathy-ad59f77dfdba77af558ae2d278c92b0a7ab747d7.tar.lz
gsoc2013-empathy-ad59f77dfdba77af558ae2d278c92b0a7ab747d7.tar.xz
gsoc2013-empathy-ad59f77dfdba77af558ae2d278c92b0a7ab747d7.tar.zst
gsoc2013-empathy-ad59f77dfdba77af558ae2d278c92b0a7ab747d7.zip
Ack received messages from ourself.
Sumana Harihareswara reported that she had started a conversation with herself, sent a message, and then tried to close the window, but whenever she did so it reappeared. This was because Empathy did not acknowledge "incoming" messages from the user themself; hence, when it Close()d the channel, Gabble respawned it, because it still had pending messages.
Diffstat (limited to 'libempathy/empathy-message.c')
-rw-r--r--libempathy/empathy-message.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index 34a466752..4b9413b1b 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -41,6 +41,7 @@ typedef struct {
time_t timestamp;
gboolean is_backlog;
guint id;
+ gboolean incoming;
} EmpathyMessagePriv;
static void empathy_message_finalize (GObject *object);
@@ -63,12 +64,14 @@ enum {
PROP_BODY,
PROP_TIMESTAMP,
PROP_IS_BACKLOG,
+ PROP_INCOMING,
};
static void
empathy_message_class_init (EmpathyMessageClass *class)
{
GObjectClass *object_class;
+ GParamSpec *pspec;
object_class = G_OBJECT_CLASS (class);
object_class->finalize = empathy_message_finalize;
@@ -123,6 +126,13 @@ empathy_message_class_init (EmpathyMessageClass *class)
G_PARAM_READWRITE));
+ pspec = g_param_spec_boolean ("incoming",
+ "Incoming",
+ "If this is an incoming (as opposed to sent) message",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_INCOMING, pspec);
+
g_type_class_add_private (object_class, sizeof (EmpathyMessagePriv));
}
@@ -179,6 +189,9 @@ message_get_property (GObject *object,
case PROP_BODY:
g_value_set_string (value, priv->body);
break;
+ case PROP_INCOMING:
+ g_value_set_boolean (value, priv->incoming);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -212,6 +225,9 @@ message_set_property (GObject *object,
empathy_message_set_body (EMPATHY_MESSAGE (object),
g_value_get_string (value));
break;
+ case PROP_INCOMING:
+ priv->incoming = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -579,6 +595,22 @@ empathy_message_set_id (EmpathyMessage *message, guint id)
priv->id = id;
}
+void
+empathy_message_set_incoming (EmpathyMessage *message, gboolean incoming)
+{
+ g_object_set (message, "incoming", incoming, NULL);
+}
+
+gboolean
+empathy_message_is_incoming (EmpathyMessage *message)
+{
+ EmpathyMessagePriv *priv = GET_PRIV (message);
+
+ g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
+
+ return priv->incoming;
+}
+
gboolean
empathy_message_equal (EmpathyMessage *message1, EmpathyMessage *message2)
{