mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
parent
0edd430925
commit
6559263b2f
@ -517,6 +517,7 @@ cmd_ac_init(void)
|
|||||||
autocomplete_add(bookmark_ac, "update");
|
autocomplete_add(bookmark_ac, "update");
|
||||||
autocomplete_add(bookmark_ac, "remove");
|
autocomplete_add(bookmark_ac, "remove");
|
||||||
autocomplete_add(bookmark_ac, "join");
|
autocomplete_add(bookmark_ac, "join");
|
||||||
|
autocomplete_add(bookmark_ac, "invites");
|
||||||
|
|
||||||
bookmark_property_ac = autocomplete_new();
|
bookmark_property_ac = autocomplete_new();
|
||||||
autocomplete_add(bookmark_property_ac, "nick");
|
autocomplete_add(bookmark_property_ac, "nick");
|
||||||
@ -1599,6 +1600,10 @@ _bookmark_autocomplete(ProfWin *window, const char *const input)
|
|||||||
if (found) {
|
if (found) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
found = autocomplete_param_with_func(input, "/bookmark invites", prefs_autocomplete_boolean_choice);
|
||||||
|
if (found) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
found = autocomplete_param_with_ac(input, "/bookmark", bookmark_ac, TRUE);
|
found = autocomplete_param_with_ac(input, "/bookmark", bookmark_ac, TRUE);
|
||||||
return found;
|
return found;
|
||||||
|
@ -807,7 +807,8 @@ static struct cmd_t command_defs[] =
|
|||||||
"/bookmark add <room> [nick <nick>] [password <password>] [autojoin on|off]",
|
"/bookmark add <room> [nick <nick>] [password <password>] [autojoin on|off]",
|
||||||
"/bookmark update <room> [nick <nick>] [password <password>] [autojoin on|off]",
|
"/bookmark update <room> [nick <nick>] [password <password>] [autojoin on|off]",
|
||||||
"/bookmark remove <room>",
|
"/bookmark remove <room>",
|
||||||
"/bookmark join <room>")
|
"/bookmark join <room>",
|
||||||
|
"/bookmark invites on|off")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Manage bookmarks and join bookmarked rooms. "
|
"Manage bookmarks and join bookmarked rooms. "
|
||||||
"In a chat room, no arguments will bookmark the current room, setting autojoin to \"on\".")
|
"In a chat room, no arguments will bookmark the current room, setting autojoin to \"on\".")
|
||||||
@ -819,7 +820,8 @@ static struct cmd_t command_defs[] =
|
|||||||
{ "nick <nick>", "Nickname used in the chat room." },
|
{ "nick <nick>", "Nickname used in the chat room." },
|
||||||
{ "password <password>", "Password if required, may be stored in plaintext on your server." },
|
{ "password <password>", "Password if required, may be stored in plaintext on your server." },
|
||||||
{ "autojoin on|off", "Whether to join the room automatically on login." },
|
{ "autojoin on|off", "Whether to join the room automatically on login." },
|
||||||
{ "join <room>", "Join room using the properties associated with the bookmark." })
|
{ "join <room>", "Join room using the properties associated with the bookmark." },
|
||||||
|
{ "invites on|off", "Whether or not to bookmark accepted room invites, defaults to 'on'."})
|
||||||
CMD_NOEXAMPLES
|
CMD_NOEXAMPLES
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -4337,7 +4337,19 @@ cmd_bookmark(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(cmd, "list") == 0) {
|
if (strcmp(cmd, "invites") == 0) {
|
||||||
|
if (g_strcmp0(args[1], "on") == 0) {
|
||||||
|
prefs_set_boolean(PREF_BOOKMARK_INVITE, TRUE);
|
||||||
|
cons_show("Auto bookmarking accepted invites enabled.");
|
||||||
|
} else if (g_strcmp0(args[1], "off") == 0) {
|
||||||
|
prefs_set_boolean(PREF_BOOKMARK_INVITE, FALSE);
|
||||||
|
cons_show("Auto bookmarking accepted invites disabled.");
|
||||||
|
} else {
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
cons_show("");
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
} else if (strcmp(cmd, "list") == 0) {
|
||||||
const GList *bookmarks = bookmark_get_list();
|
const GList *bookmarks = bookmark_get_list();
|
||||||
cons_show_bookmarks(bookmarks);
|
cons_show_bookmarks(bookmarks);
|
||||||
} else {
|
} else {
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#define PREF_GROUP_ALIAS "alias"
|
#define PREF_GROUP_ALIAS "alias"
|
||||||
#define PREF_GROUP_OTR "otr"
|
#define PREF_GROUP_OTR "otr"
|
||||||
#define PREF_GROUP_PGP "pgp"
|
#define PREF_GROUP_PGP "pgp"
|
||||||
|
#define PREF_GROUP_MUC "muc"
|
||||||
|
|
||||||
#define INPBLOCK_DEFAULT 1000
|
#define INPBLOCK_DEFAULT 1000
|
||||||
|
|
||||||
@ -1286,6 +1287,8 @@ _get_group(preference_t pref)
|
|||||||
return PREF_GROUP_OTR;
|
return PREF_GROUP_OTR;
|
||||||
case PREF_PGP_LOG:
|
case PREF_PGP_LOG:
|
||||||
return PREF_GROUP_PGP;
|
return PREF_GROUP_PGP;
|
||||||
|
case PREF_BOOKMARK_INVITE:
|
||||||
|
return PREF_GROUP_MUC;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1484,6 +1487,8 @@ _get_key(preference_t pref)
|
|||||||
return "console.private";
|
return "console.private";
|
||||||
case PREF_CONSOLE_CHAT:
|
case PREF_CONSOLE_CHAT:
|
||||||
return "console.chat";
|
return "console.chat";
|
||||||
|
case PREF_BOOKMARK_INVITE:
|
||||||
|
return "bookmark.invite";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1530,6 +1535,7 @@ _get_default_boolean(preference_t pref)
|
|||||||
case PREF_LASTACTIVITY:
|
case PREF_LASTACTIVITY:
|
||||||
case PREF_NOTIFY_MENTION_WHOLE_WORD:
|
case PREF_NOTIFY_MENTION_WHOLE_WORD:
|
||||||
case PREF_TRAY_READ:
|
case PREF_TRAY_READ:
|
||||||
|
case PREF_BOOKMARK_INVITE:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -140,6 +140,7 @@ typedef enum {
|
|||||||
PREF_CONSOLE_MUC,
|
PREF_CONSOLE_MUC,
|
||||||
PREF_CONSOLE_PRIVATE,
|
PREF_CONSOLE_PRIVATE,
|
||||||
PREF_CONSOLE_CHAT,
|
PREF_CONSOLE_CHAT,
|
||||||
|
PREF_BOOKMARK_INVITE,
|
||||||
} preference_t;
|
} preference_t;
|
||||||
|
|
||||||
typedef struct prof_alias_t {
|
typedef struct prof_alias_t {
|
||||||
|
@ -793,7 +793,13 @@ sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean c
|
|||||||
|
|
||||||
iq_room_info_request(room, FALSE);
|
iq_room_info_request(room, FALSE);
|
||||||
|
|
||||||
muc_invites_remove(room);
|
if (muc_invites_contain(room)) {
|
||||||
|
if (prefs_get_boolean(PREF_BOOKMARK_INVITE) && !bookmark_exists(room)) {
|
||||||
|
bookmark_add(room, nick, muc_invite_password(room), "on");
|
||||||
|
}
|
||||||
|
muc_invites_remove(room);
|
||||||
|
}
|
||||||
|
|
||||||
muc_roster_set_complete(room);
|
muc_roster_set_complete(room);
|
||||||
|
|
||||||
// show roster if occupants list disabled by default
|
// show roster if occupants list disabled by default
|
||||||
|
@ -717,6 +717,14 @@ cons_show_bookmarks(const GList *list)
|
|||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cons_show("");
|
||||||
|
if (prefs_get_boolean(PREF_BOOKMARK_INVITE)) {
|
||||||
|
cons_show("Automatic invite bookmarking (/bookmark invites): ON");
|
||||||
|
} else {
|
||||||
|
cons_show("Automatic invite bookmarking (/bookmark invites): OFF");
|
||||||
|
}
|
||||||
|
|
||||||
cons_alert();
|
cons_alert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +240,24 @@ bookmark_autocomplete_reset(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
bookmark_exists(const char *const room)
|
||||||
|
{
|
||||||
|
GSList *bookmarks = autocomplete_create_list(bookmark_ac);
|
||||||
|
GSList *curr = bookmarks;
|
||||||
|
while (curr) {
|
||||||
|
if (strcmp(curr->data, room) == 0) {
|
||||||
|
g_slist_free_full(bookmarks, g_free);
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
curr = g_slist_next(curr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_slist_free_full(bookmarks, g_free);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
|
_bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
|
||||||
{
|
{
|
||||||
|
@ -184,6 +184,7 @@ gboolean bookmark_join(const char *jid);
|
|||||||
const GList* bookmark_get_list(void);
|
const GList* bookmark_get_list(void);
|
||||||
char* bookmark_find(const char *const search_str);
|
char* bookmark_find(const char *const search_str);
|
||||||
void bookmark_autocomplete_reset(void);
|
void bookmark_autocomplete_reset(void);
|
||||||
|
gboolean bookmark_exists(const char *const room);
|
||||||
|
|
||||||
void roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups);
|
void roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups);
|
||||||
void roster_send_add_to_group(const char *const group, PContact contact);
|
void roster_send_add_to_group(const char *const group, PContact contact);
|
||||||
|
@ -254,6 +254,11 @@ void roster_send_name_change(const char * const barejid, const char * const new_
|
|||||||
check_expected(groups);
|
check_expected(groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean bookmark_exists(const char *const room)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void roster_send_add_to_group(const char * const group, PContact contact) {}
|
void roster_send_add_to_group(const char * const group, PContact contact) {}
|
||||||
void roster_send_remove_from_group(const char * const group, PContact contact) {}
|
void roster_send_remove_from_group(const char * const group, PContact contact) {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user