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

Merge branch 'master' into pgp

This commit is contained in:
James Booth 2015-03-29 02:51:05 +01:00
commit c36d4b3643
3 changed files with 10 additions and 4 deletions

View File

@ -234,10 +234,12 @@ message_send_invite(const char * const roomjid, const char * const contact,
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
xmpp_stanza_t *stanza; xmpp_stanza_t *stanza;
muc_member_type_t member_type = muc_member_type(roomjid); muc_member_type_t member_type = muc_member_type(roomjid);
if (member_type == MUC_MEMBER_TYPE_PUBLIC) { if (member_type == MUC_MEMBER_TYPE_PUBLIC) {
log_debug("Sending direct invite to %s, for %s", contact, roomjid); log_debug("Sending direct invite to %s, for %s", contact, roomjid);
stanza = stanza_create_invite(ctx, roomjid, contact, reason); char *password = muc_password(roomjid);
stanza = stanza_create_invite(ctx, roomjid, contact, reason, password);
} else { } else {
log_debug("Sending mediated invite to %s, for %s", contact, roomjid); log_debug("Sending mediated invite to %s, for %s", contact, roomjid);
stanza = stanza_create_mediated_invite(ctx, roomjid, contact, reason); stanza = stanza_create_mediated_invite(ctx, roomjid, contact, reason);

View File

@ -414,7 +414,7 @@ stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id,
xmpp_stanza_t * xmpp_stanza_t *
stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, stanza_create_invite(xmpp_ctx_t *ctx, const char * const room,
const char * const contact, const char * const reason) const char * const contact, const char * const reason, const char * const password)
{ {
xmpp_stanza_t *message, *x; xmpp_stanza_t *message, *x;
@ -430,9 +430,12 @@ stanza_create_invite(xmpp_ctx_t *ctx, const char * const room,
xmpp_stanza_set_ns(x, STANZA_NS_CONFERENCE); xmpp_stanza_set_ns(x, STANZA_NS_CONFERENCE);
xmpp_stanza_set_attribute(x, STANZA_ATTR_JID, room); xmpp_stanza_set_attribute(x, STANZA_ATTR_JID, room);
if (reason != NULL) { if (reason) {
xmpp_stanza_set_attribute(x, STANZA_ATTR_REASON, reason); xmpp_stanza_set_attribute(x, STANZA_ATTR_REASON, reason);
} }
if (password) {
xmpp_stanza_set_attribute(x, STANZA_ATTR_PASSWORD, password);
}
xmpp_stanza_add_child(message, x); xmpp_stanza_add_child(message, x);
xmpp_stanza_release(x); xmpp_stanza_release(x);

View File

@ -135,6 +135,7 @@
#define STANZA_ATTR_CATEGORY "category" #define STANZA_ATTR_CATEGORY "category"
#define STANZA_ATTR_REASON "reason" #define STANZA_ATTR_REASON "reason"
#define STANZA_ATTR_AUTOJOIN "autojoin" #define STANZA_ATTR_AUTOJOIN "autojoin"
#define STANZA_ATTR_PASSWORD "password"
#define STANZA_TEXT_AWAY "away" #define STANZA_TEXT_AWAY "away"
#define STANZA_TEXT_DND "dnd" #define STANZA_TEXT_DND "dnd"
@ -216,7 +217,7 @@ xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const i
const char * const to, const char * const node); const char * const to, const char * const node);
xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char * const room,
const char * const contact, const char * const reason); const char * const contact, const char * const reason, const char * const password);
xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room,
const char * const contact, const char * const reason); const char * const contact, const char * const reason);