Commit a7675b4b authored by Andrea Schaefer's avatar Andrea Schaefer

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,
timestamp = g_strdup("00:00");
}
if (buddy && purple_blist_node_get_bool (node, "chatty-notifications")) {
buddy_name = purple_buddy_get_name (buddy);
if (*message != '\0') {
// 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,
alias,
CHATTY_ICON_SIZE_SMALL,
chatty_blist_protocol_is_sms (account) ?
CHATTY_COLOR_GREEN : CHATTY_COLOR_BLUE,
FALSE);
if (flags & PURPLE_MESSAGE_RECV) {
if (buddy && purple_blist_node_get_bool (node, "chatty-notifications")) {
buddy_name = purple_buddy_get_alias (buddy);
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') {
// TODO: LELAND: UID to be implemented by XEP-0313
chatty_utils_generate_uuid(&uuid);
g_object_unref (avatar);
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,
MSG_IS_INCOMING,
message,
group_chat ? who : timestamp,
icon ? icon : NULL);
if (type == PURPLE_CONV_TYPE_CHAT){
chatty_history_add_chat_message (message, 1, account->username, real_who, uuid, mtime, conv_name);
} else {
......@@ -2238,12 +2239,12 @@ chatty_conv_write_conversation (PurpleConversation *conv,
message,
NULL,
NULL);
if (type == PURPLE_CONV_TYPE_CHAT){
chatty_history_add_chat_message (message, -1, account->username, real_who, uuid, mtime, conv_name);
} else {
chatty_history_add_im_message (message, -1, account->username, who_no_resource, uuid, mtime);
}
} else if (flags & PURPLE_MESSAGE_SYSTEM) {
if (purple_blist_node_get_bool (node, "chatty-status-msg")) {
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