aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2009-06-18 18:04:54 +0800
committerWill Thompson <will.thompson@collabora.co.uk>2009-06-18 18:14:24 +0800
commit28acd3ce10a88f912f0d3f42d14c2e5a98d619bd (patch)
tree964558eeb41d4d1b68b3ed8f0b3e763b2d16dbe0 /libempathy-gtk
parentcbfe2006c6b8e0fae731cd26c0284d7767fc4662 (diff)
downloadgsoc2013-empathy-28acd3ce10a88f912f0d3f42d14c2e5a98d619bd.tar
gsoc2013-empathy-28acd3ce10a88f912f0d3f42d14c2e5a98d619bd.tar.gz
gsoc2013-empathy-28acd3ce10a88f912f0d3f42d14c2e5a98d619bd.tar.bz2
gsoc2013-empathy-28acd3ce10a88f912f0d3f42d14c2e5a98d619bd.tar.lz
gsoc2013-empathy-28acd3ce10a88f912f0d3f42d14c2e5a98d619bd.tar.xz
gsoc2013-empathy-28acd3ce10a88f912f0d3f42d14c2e5a98d619bd.tar.zst
gsoc2013-empathy-28acd3ce10a88f912f0d3f42d14c2e5a98d619bd.zip
Include actor in part message if possible
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-chat.c68
1 files changed, 47 insertions, 21 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 44983004d..c3fc7948f 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1156,42 +1156,62 @@ chat_contacts_completion_func (const gchar *s1,
static gchar *
build_part_message (guint reason,
const gchar *name,
+ const gchar *actor,
const gchar *message)
{
- const gchar *template;
-
+ /* Having an actor only really makes sense for a few actions... */
if (message == NULL) {
switch (reason) {
case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE:
- template = _("%s has disconnected");
- break;
+ return g_strdup_printf (_("%s has disconnected"), name);
case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED:
- template = _("%s was kicked");
- break;
+ if (actor != NULL) {
+ return g_strdup_printf (
+ _("%s was kicked by %s"), name, actor);
+ } else {
+ return g_strdup_printf (_("%s was kicked"),
+ name);
+ }
case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED:
- template = _("%s was banned");
- break;
+ if (actor != NULL) {
+ return g_strdup_printf (
+ _("%s was banned by %s"), name, actor);
+ } else {
+ return g_strdup_printf (_("%s was banned"),
+ name);
+ }
default:
- template = _("%s has left the room");
+ return g_strdup_printf (_("%s has left the room"),
+ name);
}
-
- return g_strdup_printf (template, name);
} else {
switch (reason) {
case TP_CHANNEL_GROUP_CHANGE_REASON_OFFLINE:
- template = _("%s has disconnected (%s)");
- break;
+ return g_strdup_printf (_("%s has disconnected (%s)"),
+ name, message);
case TP_CHANNEL_GROUP_CHANGE_REASON_KICKED:
- template = _("%s was kicked (%s)");
- break;
+ if (actor != NULL) {
+ return g_strdup_printf (
+ _("%s was kicked by %s (%s)"), name,
+ actor, message);
+ } else {
+ return g_strdup_printf (
+ _("%s was kicked (%s)"),
+ name, message);
+ }
case TP_CHANNEL_GROUP_CHANGE_REASON_BANNED:
- template = _("%s was banned (%s)");
- break;
+ if (actor != NULL) {
+ return g_strdup_printf (
+ _("%s was banned by %s (%s)"), name,
+ actor, message);
+ } else {
+ return g_strdup_printf (_("%s was banned (%s)"),
+ name, message);
+ }
default:
- template = _("%s has left the room (%s)");
+ return g_strdup_printf (_("%s has left the room (%s)"),
+ name, message);
}
-
- return g_strdup_printf (template, name, message);
}
}
@@ -1215,7 +1235,13 @@ chat_members_changed_cb (EmpathyTpChat *tp_chat,
str = g_strdup_printf (_("%s has joined the room"),
name);
} else {
- str = build_part_message (reason, name,
+ const gchar *actor_name = NULL;
+
+ if (actor != NULL) {
+ actor_name = empathy_contact_get_name (actor);
+ }
+
+ str = build_part_message (reason, name, actor_name,
EMP_STR_EMPTY (message) ? NULL : message);
}