mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Allow hiding room server in roster
This commit is contained in:
parent
250e972b7a
commit
4c7396e77d
@ -143,6 +143,7 @@ static Autocomplete roster_presence_ac;
|
|||||||
static Autocomplete roster_char_ac;
|
static Autocomplete roster_char_ac;
|
||||||
static Autocomplete roster_remove_all_ac;
|
static Autocomplete roster_remove_all_ac;
|
||||||
static Autocomplete roster_room_ac;
|
static Autocomplete roster_room_ac;
|
||||||
|
static Autocomplete roster_room_show_ac;
|
||||||
static Autocomplete roster_room_position_ac;
|
static Autocomplete roster_room_position_ac;
|
||||||
static Autocomplete roster_room_by_ac;
|
static Autocomplete roster_room_by_ac;
|
||||||
static Autocomplete roster_room_order_ac;
|
static Autocomplete roster_room_order_ac;
|
||||||
@ -469,6 +470,11 @@ cmd_ac_init(void)
|
|||||||
autocomplete_add(roster_room_ac, "order");
|
autocomplete_add(roster_room_ac, "order");
|
||||||
autocomplete_add(roster_room_ac, "unread");
|
autocomplete_add(roster_room_ac, "unread");
|
||||||
autocomplete_add(roster_room_ac, "private");
|
autocomplete_add(roster_room_ac, "private");
|
||||||
|
autocomplete_add(roster_room_ac, "show");
|
||||||
|
autocomplete_add(roster_room_ac, "hide");
|
||||||
|
|
||||||
|
roster_room_show_ac = autocomplete_new();
|
||||||
|
autocomplete_add(roster_room_show_ac, "server");
|
||||||
|
|
||||||
roster_room_by_ac = autocomplete_new();
|
roster_room_by_ac = autocomplete_new();
|
||||||
autocomplete_add(roster_room_by_ac, "service");
|
autocomplete_add(roster_room_by_ac, "service");
|
||||||
@ -979,6 +985,7 @@ cmd_ac_reset(ProfWin *window)
|
|||||||
autocomplete_reset(roster_count_ac);
|
autocomplete_reset(roster_count_ac);
|
||||||
autocomplete_reset(roster_order_ac);
|
autocomplete_reset(roster_order_ac);
|
||||||
autocomplete_reset(roster_room_ac);
|
autocomplete_reset(roster_room_ac);
|
||||||
|
autocomplete_reset(roster_room_show_ac);
|
||||||
autocomplete_reset(roster_room_by_ac);
|
autocomplete_reset(roster_room_by_ac);
|
||||||
autocomplete_reset(roster_unread_ac);
|
autocomplete_reset(roster_unread_ac);
|
||||||
autocomplete_reset(roster_room_position_ac);
|
autocomplete_reset(roster_room_position_ac);
|
||||||
@ -1098,6 +1105,7 @@ cmd_ac_uninit(void)
|
|||||||
autocomplete_free(roster_count_ac);
|
autocomplete_free(roster_count_ac);
|
||||||
autocomplete_free(roster_order_ac);
|
autocomplete_free(roster_order_ac);
|
||||||
autocomplete_free(roster_room_ac);
|
autocomplete_free(roster_room_ac);
|
||||||
|
autocomplete_free(roster_room_show_ac);
|
||||||
autocomplete_free(roster_room_by_ac);
|
autocomplete_free(roster_room_by_ac);
|
||||||
autocomplete_free(roster_unread_ac);
|
autocomplete_free(roster_unread_ac);
|
||||||
autocomplete_free(roster_room_position_ac);
|
autocomplete_free(roster_room_position_ac);
|
||||||
@ -1550,6 +1558,14 @@ _roster_autocomplete(ProfWin *window, const char *const input, gboolean previous
|
|||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
result = autocomplete_param_with_ac(input, "/roster room show", roster_room_show_ac, TRUE, previous);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = autocomplete_param_with_ac(input, "/roster room hide", roster_room_show_ac, TRUE, previous);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = autocomplete_param_with_func(input, "/roster count zero", prefs_autocomplete_boolean_choice, previous);
|
result = autocomplete_param_with_func(input, "/roster count zero", prefs_autocomplete_boolean_choice, previous);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -287,6 +287,8 @@ static struct cmd_t command_defs[] =
|
|||||||
"/roster room by service|none",
|
"/roster room by service|none",
|
||||||
"/roster room order name|unread",
|
"/roster room order name|unread",
|
||||||
"/roster room unread before|after|off",
|
"/roster room unread before|after|off",
|
||||||
|
"/roster room show server",
|
||||||
|
"/roster room hide server",
|
||||||
"/roster private room|group|off",
|
"/roster private room|group|off",
|
||||||
"/roster private char <char>|none",
|
"/roster private char <char>|none",
|
||||||
"/roster header char <char>|none",
|
"/roster header char <char>|none",
|
||||||
@ -352,6 +354,8 @@ static struct cmd_t command_defs[] =
|
|||||||
{ "room unread before", "Show unread message count before room." },
|
{ "room unread before", "Show unread message count before room." },
|
||||||
{ "room unread after", "Show unread message count after room." },
|
{ "room unread after", "Show unread message count after room." },
|
||||||
{ "room unread off", "Do not show unread message count for rooms." },
|
{ "room unread off", "Do not show unread message count for rooms." },
|
||||||
|
{ "room show server", "Show the conference server with room JIDs." },
|
||||||
|
{ "room hide server", "Do not show the conference server with room JIDs." },
|
||||||
{ "private room", "Show room private chats with the room." },
|
{ "private room", "Show room private chats with the room." },
|
||||||
{ "private group", "Show room private chats as a separate roster group." },
|
{ "private group", "Show room private chats as a separate roster group." },
|
||||||
{ "private off", "Do not show room private chats." },
|
{ "private off", "Do not show room private chats." },
|
||||||
|
@ -2869,6 +2869,30 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
|
|||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
} else if (g_strcmp0(args[1], "show") == 0) {
|
||||||
|
if (g_strcmp0(args[2], "server") == 0) {
|
||||||
|
cons_show("Roster room server enabled.");
|
||||||
|
prefs_set_boolean(PREF_ROSTER_ROOMS_SERVER, TRUE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
|
rosterwin_roster();
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
} else if (g_strcmp0(args[1], "hide") == 0) {
|
||||||
|
if (g_strcmp0(args[2], "server") == 0) {
|
||||||
|
cons_show("Roster room server disabled.");
|
||||||
|
prefs_set_boolean(PREF_ROSTER_ROOMS_SERVER, FALSE);
|
||||||
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
|
rosterwin_roster();
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1560,6 +1560,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_ROSTER_ROOMS_BY:
|
case PREF_ROSTER_ROOMS_BY:
|
||||||
case PREF_ROSTER_ROOMS_ORDER:
|
case PREF_ROSTER_ROOMS_ORDER:
|
||||||
case PREF_ROSTER_ROOMS_UNREAD:
|
case PREF_ROSTER_ROOMS_UNREAD:
|
||||||
|
case PREF_ROSTER_ROOMS_SERVER:
|
||||||
case PREF_ROSTER_PRIVATE:
|
case PREF_ROSTER_PRIVATE:
|
||||||
case PREF_RESOURCE_TITLE:
|
case PREF_RESOURCE_TITLE:
|
||||||
case PREF_RESOURCE_MESSAGE:
|
case PREF_RESOURCE_MESSAGE:
|
||||||
@ -1791,6 +1792,8 @@ _get_key(preference_t pref)
|
|||||||
return "roster.rooms.order";
|
return "roster.rooms.order";
|
||||||
case PREF_ROSTER_ROOMS_UNREAD:
|
case PREF_ROSTER_ROOMS_UNREAD:
|
||||||
return "roster.rooms.unread";
|
return "roster.rooms.unread";
|
||||||
|
case PREF_ROSTER_ROOMS_SERVER:
|
||||||
|
return "roster.rooms.server";
|
||||||
case PREF_ROSTER_PRIVATE:
|
case PREF_ROSTER_PRIVATE:
|
||||||
return "roster.private";
|
return "roster.private";
|
||||||
case PREF_RESOURCE_TITLE:
|
case PREF_RESOURCE_TITLE:
|
||||||
|
@ -84,6 +84,7 @@ typedef enum {
|
|||||||
PREF_ROSTER_ROOMS_BY,
|
PREF_ROSTER_ROOMS_BY,
|
||||||
PREF_ROSTER_ROOMS_ORDER,
|
PREF_ROSTER_ROOMS_ORDER,
|
||||||
PREF_ROSTER_ROOMS_UNREAD,
|
PREF_ROSTER_ROOMS_UNREAD,
|
||||||
|
PREF_ROSTER_ROOMS_SERVER,
|
||||||
PREF_ROSTER_PRIVATE,
|
PREF_ROSTER_PRIVATE,
|
||||||
PREF_MUC_PRIVILEGES,
|
PREF_MUC_PRIVILEGES,
|
||||||
PREF_PRESENCE,
|
PREF_PRESENCE,
|
||||||
|
@ -427,6 +427,7 @@ _load_preferences(void)
|
|||||||
_set_string_preference("roster.unread", PREF_ROSTER_UNREAD);
|
_set_string_preference("roster.unread", PREF_ROSTER_UNREAD);
|
||||||
_set_string_preference("roster.rooms.order", PREF_ROSTER_ROOMS_ORDER);
|
_set_string_preference("roster.rooms.order", PREF_ROSTER_ROOMS_ORDER);
|
||||||
_set_string_preference("roster.rooms.unread", PREF_ROSTER_ROOMS_UNREAD);
|
_set_string_preference("roster.rooms.unread", PREF_ROSTER_ROOMS_UNREAD);
|
||||||
|
_set_string_preference("roster.rooms.server", PREF_ROSTER_ROOMS_SERVER);
|
||||||
_set_string_preference("roster.rooms.pos", PREF_ROSTER_ROOMS_POS);
|
_set_string_preference("roster.rooms.pos", PREF_ROSTER_ROOMS_POS);
|
||||||
_set_string_preference("roster.rooms.by", PREF_ROSTER_ROOMS_BY);
|
_set_string_preference("roster.rooms.by", PREF_ROSTER_ROOMS_BY);
|
||||||
_set_string_preference("roster.private", PREF_ROSTER_PRIVATE);
|
_set_string_preference("roster.private", PREF_ROSTER_PRIVATE);
|
||||||
|
@ -762,7 +762,14 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
|
|||||||
g_string_append(msg, jidp->localpart);
|
g_string_append(msg, jidp->localpart);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
} else {
|
} else {
|
||||||
g_string_append(msg, mucwin->roomjid);
|
gboolean show_server = prefs_get_boolean(PREF_ROSTER_ROOMS_SERVER);
|
||||||
|
if (show_server) {
|
||||||
|
g_string_append(msg, mucwin->roomjid);
|
||||||
|
} else {
|
||||||
|
Jid *jidp = jid_create(mucwin->roomjid);
|
||||||
|
g_string_append(msg, jidp->localpart);
|
||||||
|
jid_destroy(jidp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
prefs_free_string(roombypref);
|
prefs_free_string(roombypref);
|
||||||
if ((g_strcmp0(unreadpos, "after") == 0) && mucwin->unread > 0) {
|
if ((g_strcmp0(unreadpos, "after") == 0) && mucwin->unread > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user