1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into plugins

This commit is contained in:
James Booth 2014-01-26 01:07:54 +00:00
commit fb3f8aa149
3 changed files with 8 additions and 9 deletions

View File

@ -88,10 +88,10 @@ _message_send(const char * const msg, const char * const recipient)
if (prefs_get_boolean(PREF_STATES) && chat_session_get_recipient_supports(jid)) { if (prefs_get_boolean(PREF_STATES) && chat_session_get_recipient_supports(jid)) {
chat_session_set_active(jid); chat_session_set_active(jid);
message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT, message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT,
msg, STANZA_NAME_ACTIVE, NULL); msg, STANZA_NAME_ACTIVE);
} else { } else {
message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT, message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT,
msg, NULL, NULL); msg, NULL);
} }
xmpp_send(conn, message); xmpp_send(conn, message);
@ -104,7 +104,7 @@ _message_send_groupchat(const char * const msg, const char * const recipient)
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
xmpp_stanza_t *message = stanza_create_message(ctx, recipient, xmpp_stanza_t *message = stanza_create_message(ctx, recipient,
STANZA_TYPE_GROUPCHAT, msg, NULL, NULL); STANZA_TYPE_GROUPCHAT, msg, NULL);
xmpp_send(conn, message); xmpp_send(conn, message);
xmpp_stanza_release(message); xmpp_stanza_release(message);
@ -116,7 +116,7 @@ _message_send_duck(const char * const query)
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
xmpp_stanza_t *message = stanza_create_message(ctx, "im@ddg.gg", xmpp_stanza_t *message = stanza_create_message(ctx, "im@ddg.gg",
STANZA_TYPE_CHAT, query, NULL, NULL); STANZA_TYPE_CHAT, query, NULL);
xmpp_send(conn, message); xmpp_send(conn, message);
xmpp_stanza_release(message); xmpp_stanza_release(message);

View File

@ -115,7 +115,7 @@ stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const recipient,
xmpp_stanza_t * xmpp_stanza_t *
stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient, stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient,
const char * const type, const char * const message, const char * const type, const char * const message,
const char * const state, const char * const id) const char * const state)
{ {
xmpp_stanza_t *msg, *body, *text; xmpp_stanza_t *msg, *body, *text;
@ -123,9 +123,8 @@ stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient,
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE);
xmpp_stanza_set_type(msg, type); xmpp_stanza_set_type(msg, type);
xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, recipient); xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, recipient);
if (id != NULL) { char *id = generate_unique_id(NULL);
xmpp_stanza_set_id(msg, id); xmpp_stanza_set_id(msg, id);
}
body = xmpp_stanza_new(ctx); body = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(body, STANZA_NAME_BODY); xmpp_stanza_set_name(body, STANZA_NAME_BODY);

View File

@ -124,7 +124,7 @@ xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t *ctx,
xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx,
const char * const recipient, const char * const type, const char * const recipient, const char * const type,
const char * const message, const char * const state, const char * const id); const char * const message, const char * const state);
xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t * const ctx, xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t * const ctx,
const char * const full_room_jid); const char * const full_room_jid);