Commit 16980184 authored by Andrea Schaefer's avatar Andrea Schaefer

Fix newline issue in contact-row description

parent 177559b0
......@@ -1426,12 +1426,13 @@ chatty_blist_chats_update_node (PurpleBuddy *buddy,
GtkListBox *listbox;
GdkPixbuf *avatar;
g_autofree gchar *name = NULL;
g_autofree gchar *last_msg = NULL;
g_autofree gchar *last_msg_text = NULL;
g_autofree gchar *last_msg_ts = NULL;
g_autofree gchar *unread_messages = NULL;
g_autofree gchar *last_message_striped = NULL;
const gchar *tag;
const gchar *alias;
g_autofree gchar *last_message_striped = NULL;
gboolean notify;
gboolean blur;
......@@ -1489,6 +1490,8 @@ chatty_blist_chats_update_node (PurpleBuddy *buddy,
tag,
last_message_striped);
last_msg = chatty_utils_strip_newlines (last_msg_text);
last_msg_ts = chatty_utils_time_ago_in_words (chatty_node->conv.last_msg_ts_raw,
CHATTY_UTILS_TIME_AGO_SHOW_DATE);
......@@ -1511,7 +1514,7 @@ chatty_blist_chats_update_node (PurpleBuddy *buddy,
chatty_node->row_chat = CHATTY_CONTACT_ROW (chatty_contact_row_new ((gpointer) node,
avatar,
name,
last_msg_text,
last_msg,
last_msg_ts,
unread_messages,
NULL,
......@@ -1524,7 +1527,7 @@ chatty_blist_chats_update_node (PurpleBuddy *buddy,
g_object_set (chatty_node->row_chat,
"avatar", avatar,
"name", name,
"description", last_msg_text,
"description", last_msg,
"timestamp", last_msg_ts,
"message_count", unread_messages,
NULL);
......@@ -1538,8 +1541,6 @@ chatty_blist_chats_update_node (PurpleBuddy *buddy,
}
/**
* chatty_blist_chats_update_group_chat:
* @buddy: a PurpleBuddy
......
......@@ -205,6 +205,24 @@ chatty_utils_strip_blanks (const char *string)
}
char *
chatty_utils_strip_newlines (const char *string)
{
char *result;
char **chunks;
chunks = g_strsplit (string, "\n", 0);
result = g_strjoinv(" ", chunks);
g_strstrip (result);
g_strfreev (chunks);
return result;
}
char*
chatty_utils_format_phonenumber (const char *phone_number)
{
......
......@@ -20,6 +20,7 @@ typedef enum {
char *chatty_utils_jabber_id_strip (const char *name);
char *chatty_utils_strip_blanks (const char *string);
char *chatty_utils_strip_newlines (const char *string);
char *chatty_utils_format_phonenumber (const char *phone_number);
void chatty_utils_generate_uuid (char **uuid);
char *chatty_utils_time_ago_in_words (time_t time_stamp, ChattyTimeAgoFlags flags);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment