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

Removed bookmark autojoin limit

This commit is contained in:
James Booth 2014-11-20 22:33:46 +00:00
parent 81b1009fd9
commit 5030d49952

View File

@ -50,10 +50,6 @@
#include "ui/ui.h"
#define BOOKMARK_TIMEOUT 5000
/* TODO: replace with a preference */
#define BOOKMARK_AUTOJOIN_MAX 5
static int autojoin_count;
static Autocomplete bookmark_ac;
static GList *bookmark_list;
@ -76,7 +72,6 @@ bookmark_request(void)
id = strdup("bookmark_init_request");
autojoin_count = 0;
autocomplete_free(bookmark_ac);
bookmark_ac = autocomplete_new();
if (bookmark_list != NULL) {
@ -330,28 +325,22 @@ _bookmark_handle_result(xmpp_conn_t * const conn,
bookmark_list = g_list_append(bookmark_list, item);
if (autojoin_val) {
if (autojoin_count < BOOKMARK_AUTOJOIN_MAX) {
Jid *room_jid;
Jid *room_jid;
++autojoin_count;
char *account_name = jabber_get_account_name();
ProfAccount *account = accounts_get_account(account_name);
if (name == NULL) {
name = account->muc_nick;
}
log_debug("Autojoin %s with nick=%s", jid, name);
room_jid = jid_create_from_bare_and_resource(jid, name);
if (!muc_active(room_jid->barejid)) {
presence_join_room(jid, name, password);
muc_join(jid, name, password, TRUE);
}
jid_destroy(room_jid);
account_free(account);
} else {
log_debug("Rejected autojoin %s (maximum has been reached)", jid);
char *account_name = jabber_get_account_name();
ProfAccount *account = accounts_get_account(account_name);
if (name == NULL) {
name = account->muc_nick;
}
log_debug("Autojoin %s with nick=%s", jid, name);
room_jid = jid_create_from_bare_and_resource(jid, name);
if (!muc_active(room_jid->barejid)) {
presence_join_room(jid, name, password);
muc_join(jid, name, password, TRUE);
}
jid_destroy(room_jid);
account_free(account);
}
ptr = xmpp_stanza_get_next(ptr);