mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Use stanza module to create groupchat messages
This commit is contained in:
parent
f90d13bd5e
commit
f167fdd55d
25
src/jabber.c
25
src/jabber.c
@ -167,28 +167,11 @@ jabber_send(const char * const msg, const char * const recipient)
|
||||
void
|
||||
jabber_send_groupchat(const char * const msg, const char * const recipient)
|
||||
{
|
||||
char *encoded_xml = encode_xml(msg);
|
||||
xmpp_stanza_t *message = stanza_create_message(jabber_conn.ctx, recipient,
|
||||
"groupchat", msg, NULL);
|
||||
|
||||
xmpp_stanza_t *reply, *body, *text;
|
||||
|
||||
reply = xmpp_stanza_new(jabber_conn.ctx);
|
||||
xmpp_stanza_set_name(reply, "message");
|
||||
xmpp_stanza_set_type(reply, "groupchat");
|
||||
xmpp_stanza_set_attribute(reply, "to", recipient);
|
||||
|
||||
body = xmpp_stanza_new(jabber_conn.ctx);
|
||||
xmpp_stanza_set_name(body, "body");
|
||||
|
||||
text = xmpp_stanza_new(jabber_conn.ctx);
|
||||
xmpp_stanza_set_text(text, encoded_xml);
|
||||
|
||||
xmpp_stanza_add_child(body, text);
|
||||
xmpp_stanza_add_child(reply, body);
|
||||
|
||||
xmpp_send(jabber_conn.conn, reply);
|
||||
xmpp_stanza_release(reply);
|
||||
|
||||
free(encoded_xml);
|
||||
xmpp_send(jabber_conn.conn, message);
|
||||
xmpp_stanza_release(message);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -54,7 +54,7 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient,
|
||||
|
||||
msg = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(msg, "message");
|
||||
xmpp_stanza_set_type(msg, "chat");
|
||||
xmpp_stanza_set_type(msg, type);
|
||||
xmpp_stanza_set_attribute(msg, "to", recipient);
|
||||
|
||||
body = xmpp_stanza_new(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user