fix pm notifs

v1
Tony Olagbaiye 3 years ago
parent 9c03d4d660
commit 7d48adaf24
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

@ -782,7 +782,7 @@ void channel__send_message(struct t_account *account, struct t_channel *channel,
xmpp_stanza_release(message); xmpp_stanza_release(message);
if (channel->type != CHANNEL_TYPE_MUC) if (channel->type != CHANNEL_TYPE_MUC)
weechat_printf_date_tags(channel->buffer, 0, weechat_printf_date_tags(channel->buffer, 0,
"xmpp_message,message,notify_none,self_msg,log1", "xmpp_message,message,private,notify_none,self_msg,log1",
"%s\t%s", "%s\t%s",
user__as_prefix_raw(account, account_jid(account)), user__as_prefix_raw(account, account_jid(account)),
body); body);

@ -188,7 +188,6 @@ int connection__message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *
if (from == NULL) if (from == NULL)
return 1; return 1;
from_bare = xmpp_jid_bare(account->context, from); from_bare = xmpp_jid_bare(account->context, from);
from = xmpp_jid_resource(account->context, from);
channel = channel__search(account, from_bare); channel = channel__search(account, from_bare);
if (!channel) if (!channel)
return 1; return 1;
@ -206,19 +205,10 @@ int connection__message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *
sent, "forwarded", "urn:xmpp:forward:0"); sent, "forwarded", "urn:xmpp:forward:0");
received = xmpp_stanza_get_child_by_name_and_ns( received = xmpp_stanza_get_child_by_name_and_ns(
stanza, "received", "urn:xmpp:carbons:2"); stanza, "received", "urn:xmpp:carbons:2");
if (sent && forwarded != NULL)
{
xmpp_stanza_t *message = xmpp_stanza_get_children(forwarded);
//from = xmpp_stanza_get_from(stanza);
//to = xmpp_stanza_get_to(stanza);
//xmpp_stanza_set_from(stanza, to);
//xmpp_stanza_set_to(stanza, from);
return connection__message_handler(conn, message, userdata);
}
if (received) if (received)
forwarded = xmpp_stanza_get_child_by_name_and_ns( forwarded = xmpp_stanza_get_child_by_name_and_ns(
received, "forwarded", "urn:xmpp:forward:0"); received, "forwarded", "urn:xmpp:forward:0");
if (received && forwarded != NULL) if ((sent || received) && forwarded != NULL)
{ {
xmpp_stanza_t *message = xmpp_stanza_get_children(forwarded); xmpp_stanza_t *message = xmpp_stanza_get_children(forwarded);
return connection__message_handler(conn, message, userdata); return connection__message_handler(conn, message, userdata);
@ -401,10 +391,10 @@ int connection__message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *
weechat_string_dyn_concat(dyn_tags, id, -1); weechat_string_dyn_concat(dyn_tags, id, -1);
} }
if (strcmp(to, channel->id) == 0) if (channel->type == CHANNEL_TYPE_PM)
weechat_string_dyn_concat(dyn_tags, ",private", -1); weechat_string_dyn_concat(dyn_tags, ",private", -1);
if (weechat_string_match(intext, "/me *", 0)) if (weechat_string_match(intext, "/me *", 0))
weechat_string_dyn_concat(dyn_tags, ",action", -1); weechat_string_dyn_concat(dyn_tags, ",xmpp_action", -1);
if (replace) if (replace)
{ {
weechat_string_dyn_concat(dyn_tags, ",edit", -1); weechat_string_dyn_concat(dyn_tags, ",edit", -1);
@ -414,6 +404,8 @@ int connection__message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *
if (date != 0) if (date != 0)
weechat_string_dyn_concat(dyn_tags, ",notify_none", -1); weechat_string_dyn_concat(dyn_tags, ",notify_none", -1);
else if (channel->type == CHANNEL_TYPE_PM)
weechat_string_dyn_concat(dyn_tags, ",notify_private", -1);
else else
weechat_string_dyn_concat(dyn_tags, ",log1", -1); weechat_string_dyn_concat(dyn_tags, ",log1", -1);

@ -46,8 +46,8 @@ int input__data(struct t_gui_buffer *buffer, const char *text)
} }
int input__data_cb(const void *pointer, void *data, int input__data_cb(const void *pointer, void *data,
struct t_gui_buffer *buffer, struct t_gui_buffer *buffer,
const char *text) const char *text)
{ {
(void) pointer; (void) pointer;
(void) data; (void) data;

Loading…
Cancel
Save