mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Add /roster room use
command
`/roster room use name` to use the name of the MUC in the roster list. `/roster room use jid` to use the jid of the MUC in the roster list. Display it only in case `/roster room by none` is set so far.
This commit is contained in:
parent
3066fd77fc
commit
9e35861001
@ -291,6 +291,8 @@ static struct cmd_t command_defs[] =
|
||||
"/roster room unread before|after|off",
|
||||
"/roster room show server",
|
||||
"/roster room hide server",
|
||||
"/roster room use name",
|
||||
"/roster room use jid",
|
||||
"/roster private room|group|off",
|
||||
"/roster private char <char>|none",
|
||||
"/roster header char <char>|none",
|
||||
@ -364,6 +366,8 @@ static struct cmd_t command_defs[] =
|
||||
{ "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." },
|
||||
{ "room use name", "Use the MUC name as room name." },
|
||||
{ "room use jid", "Use the JID as room name." },
|
||||
{ "private room", "Show room private chats with the room." },
|
||||
{ "private group", "Show room private chats as a separate roster group." },
|
||||
{ "private off", "Do not show room private chats." },
|
||||
|
@ -2861,6 +2861,25 @@ cmd_roster(ProfWin *window, const char *const command, gchar **args)
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (g_strcmp0(args[1], "use") == 0) {
|
||||
if (g_strcmp0(args[2], "jid") == 0) {
|
||||
cons_show("Roster room display jid as name.");
|
||||
prefs_set_string(PREF_ROSTER_ROOMS_USE_AS_NAME, "jid");
|
||||
if (conn_status == JABBER_CONNECTED) {
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[2], "name") == 0) {
|
||||
cons_show("Roster room display room name as name.");
|
||||
prefs_set_string(PREF_ROSTER_ROOMS_USE_AS_NAME, "name");
|
||||
if (conn_status == JABBER_CONNECTED) {
|
||||
rosterwin_roster();
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
|
@ -1701,6 +1701,7 @@ _get_group(preference_t pref)
|
||||
case PREF_ROSTER_ROOMS_ORDER:
|
||||
case PREF_ROSTER_ROOMS_UNREAD:
|
||||
case PREF_ROSTER_ROOMS_SERVER:
|
||||
case PREF_ROSTER_ROOMS_USE_AS_NAME:
|
||||
case PREF_ROSTER_PRIVATE:
|
||||
case PREF_RESOURCE_TITLE:
|
||||
case PREF_RESOURCE_MESSAGE:
|
||||
@ -1948,6 +1949,8 @@ _get_key(preference_t pref)
|
||||
return "roster.rooms.unread";
|
||||
case PREF_ROSTER_ROOMS_SERVER:
|
||||
return "roster.rooms.server";
|
||||
case PREF_ROSTER_ROOMS_USE_AS_NAME:
|
||||
return "roster.rooms.use.name";
|
||||
case PREF_ROSTER_PRIVATE:
|
||||
return "roster.private";
|
||||
case PREF_RESOURCE_TITLE:
|
||||
@ -2082,6 +2085,8 @@ _get_default_string(preference_t pref)
|
||||
return "last";
|
||||
case PREF_ROSTER_ROOMS_BY:
|
||||
return "none";
|
||||
case PREF_ROSTER_ROOMS_USE_AS_NAME:
|
||||
return "name";
|
||||
case PREF_ROSTER_ROOMS_ORDER:
|
||||
return "name";
|
||||
case PREF_ROSTER_ROOMS_UNREAD:
|
||||
|
@ -88,6 +88,7 @@ typedef enum {
|
||||
PREF_ROSTER_ROOMS_ORDER,
|
||||
PREF_ROSTER_ROOMS_UNREAD,
|
||||
PREF_ROSTER_ROOMS_SERVER,
|
||||
PREF_ROSTER_ROOMS_USE_AS_NAME,
|
||||
PREF_ROSTER_PRIVATE,
|
||||
PREF_MUC_PRIVILEGES,
|
||||
PREF_PRESENCE,
|
||||
|
@ -336,6 +336,7 @@ _load_preferences(void)
|
||||
_set_string_preference("roster.rooms.by", PREF_ROSTER_ROOMS_BY);
|
||||
_set_string_preference("roster.private", PREF_ROSTER_PRIVATE);
|
||||
_set_string_preference("roster.count", PREF_ROSTER_COUNT);
|
||||
_set_string_preference("roster.rooms.use.name", PREF_ROSTER_ROOMS_USE_AS_NAME);
|
||||
_set_string_preference("statusbar.self", PREF_STATUSBAR_SELF);
|
||||
_set_string_preference("statusbar.chat", PREF_STATUSBAR_CHAT);
|
||||
_set_string_preference("statusbar.room", PREF_STATUSBAR_ROOM);
|
||||
|
@ -775,13 +775,29 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
|
||||
jid_destroy(jidp);
|
||||
} else {
|
||||
gboolean show_server = prefs_get_boolean(PREF_ROSTER_ROOMS_SERVER);
|
||||
char *use_as_name = prefs_get_string(PREF_ROSTER_ROOMS_USE_AS_NAME);
|
||||
|
||||
if (show_server) {
|
||||
g_string_append(msg, mucwin->roomjid);
|
||||
if (mucwin->room_name == NULL ||
|
||||
(g_strcmp0(use_as_name, "jid") == 0)) {
|
||||
g_string_append(msg, mucwin->roomjid);
|
||||
} else {
|
||||
g_string_append(msg, mucwin->room_name);
|
||||
}
|
||||
} else {
|
||||
Jid *jidp = jid_create(mucwin->roomjid);
|
||||
g_string_append(msg, jidp->localpart);
|
||||
|
||||
if (mucwin->room_name == NULL ||
|
||||
(g_strcmp0(use_as_name, "jid") == 0)) {
|
||||
g_string_append(msg, jidp->localpart);
|
||||
} else {
|
||||
g_string_append(msg, mucwin->room_name);
|
||||
}
|
||||
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
|
||||
prefs_free_string(use_as_name);
|
||||
}
|
||||
prefs_free_string(roombypref);
|
||||
if ((g_strcmp0(unreadpos, "after") == 0) && mucwin->unread > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user