1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Handle headline stanza

Authored by DebXWoody in:
https://github.com/profanity-im/profanity/pull/1369

Regards: https://github.com/profanity-im/profanity/issues/1366

Since I'm in the process of cleaning up message.c I take this now
so he doesn't have to rebase.

I also omitted the _handle_normal() case since I'm not sure that would
be correct.

Probably will be addressed again when continuing the cleanup.
This commit is contained in:
Stefan Kropp 2020-07-03 12:02:41 +02:00 committed by Michael Vetter
parent 83c6aa68f1
commit 3640900cf6

View File

@ -109,6 +109,19 @@ _handled_by_plugin(xmpp_stanza_t *const stanza)
return !cont;
}
static void
_handle_headline(xmpp_stanza_t *const stanza)
{
char* text = NULL;
xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY);
if (body) {
text = xmpp_stanza_get_text(body);
if (text) {
cons_show("Headline: %s", text);
}
}
}
static int
_message_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata)
{
@ -127,7 +140,7 @@ _message_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *con
// XEP-0045: Multi-User Chat
_handle_groupchat(stanza);
} else if (g_strcmp0(type, STANZA_TYPE_HEADLINE) == 0) {
//TODO: implement headline
_handle_headline(stanza);
} else if (type == NULL || g_strcmp0(type, STANZA_TYPE_CHAT) != 0 || g_strcmp0(type, STANZA_TYPE_NORMAL) != 0 ) {
// type: chat, normal (==NULL)