Commit a7675b4b authored by Andrea Schaefer's avatar Andrea Schaefer
Browse files

Show notifications only for received messages

Set notification title with alias instead of user ID
parent 052337b5
...@@ -2196,37 +2196,38 @@ chatty_conv_write_conversation (PurpleConversation *conv, ...@@ -2196,37 +2196,38 @@ chatty_conv_write_conversation (PurpleConversation *conv,
timestamp = g_strdup("00:00"); timestamp = g_strdup("00:00");
} }
if (buddy && purple_blist_node_get_bool (node, "chatty-notifications")) { if (*message != '\0') {
buddy_name = purple_buddy_get_name (buddy); // TODO UID to be implemented by XEP-0313
chatty_utils_generate_uuid(&uuid);
titel = g_strdup_printf (_("New message from %s"), buddy_name); who_no_resource = chatty_utils_jabber_id_strip(who);
avatar = chatty_icon_get_buddy_icon ((PurpleBlistNode*)buddy, if (flags & PURPLE_MESSAGE_RECV) {
alias, if (buddy && purple_blist_node_get_bool (node, "chatty-notifications")) {
CHATTY_ICON_SIZE_SMALL, buddy_name = purple_buddy_get_alias (buddy);
chatty_blist_protocol_is_sms (account) ?
CHATTY_COLOR_GREEN : CHATTY_COLOR_BLUE,
FALSE);
chatty_notify_show_notification (titel, message, CHATTY_NOTIFY_MESSAGE_RECEIVED, conv, avatar); titel = g_strdup_printf (_("New message from %s"), buddy_name);
g_object_unref (avatar); avatar = chatty_icon_get_buddy_icon ((PurpleBlistNode*)buddy,
alias,
CHATTY_ICON_SIZE_SMALL,
chatty_blist_protocol_is_sms (account) ?
CHATTY_COLOR_GREEN : CHATTY_COLOR_BLUE,
FALSE);
g_free (titel); chatty_notify_show_notification (titel, message, CHATTY_NOTIFY_MESSAGE_RECEIVED, conv, avatar);
}
if (*message != '\0') { g_object_unref (avatar);
// TODO: LELAND: UID to be implemented by XEP-0313
chatty_utils_generate_uuid(&uuid);
who_no_resource = chatty_utils_jabber_id_strip(who); g_free (titel);
}
if (flags & PURPLE_MESSAGE_RECV) {
chatty_msg_list_add_message (chatty_conv->msg_list, chatty_msg_list_add_message (chatty_conv->msg_list,
MSG_IS_INCOMING, MSG_IS_INCOMING,
message, message,
group_chat ? who : timestamp, group_chat ? who : timestamp,
icon ? icon : NULL); icon ? icon : NULL);
if (type == PURPLE_CONV_TYPE_CHAT){ if (type == PURPLE_CONV_TYPE_CHAT){
chatty_history_add_chat_message (message, 1, account->username, real_who, uuid, mtime, conv_name); chatty_history_add_chat_message (message, 1, account->username, real_who, uuid, mtime, conv_name);
} else { } else {
...@@ -2238,12 +2239,12 @@ chatty_conv_write_conversation (PurpleConversation *conv, ...@@ -2238,12 +2239,12 @@ chatty_conv_write_conversation (PurpleConversation *conv,
message, message,
NULL, NULL,
NULL); NULL);
if (type == PURPLE_CONV_TYPE_CHAT){ if (type == PURPLE_CONV_TYPE_CHAT){
chatty_history_add_chat_message (message, -1, account->username, real_who, uuid, mtime, conv_name); chatty_history_add_chat_message (message, -1, account->username, real_who, uuid, mtime, conv_name);
} else { } else {
chatty_history_add_im_message (message, -1, account->username, who_no_resource, uuid, mtime); chatty_history_add_im_message (message, -1, account->username, who_no_resource, uuid, mtime);
} }
} else if (flags & PURPLE_MESSAGE_SYSTEM) { } else if (flags & PURPLE_MESSAGE_SYSTEM) {
if (purple_blist_node_get_bool (node, "chatty-status-msg")) { if (purple_blist_node_get_bool (node, "chatty-status-msg")) {
chatty_msg_list_add_message (chatty_conv->msg_list, chatty_msg_list_add_message (chatty_conv->msg_list,
......
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