Merge pull request #2126 from profanity-im/fix/2125
fix(ui): Fix custom outgoing stamp and fix stamp command help
This commit is contained in:
@@ -108,6 +108,7 @@ static char* _lastactivity_autocomplete(ProfWin* window, const char* const input
|
|||||||
static char* _intype_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _intype_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _mood_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _mood_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _strophe_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _strophe_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
|
static char* _stamp_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _adhoc_cmd_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _adhoc_cmd_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _vcard_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _vcard_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
|
|
||||||
@@ -260,6 +261,8 @@ static Autocomplete mood_type_ac;
|
|||||||
static Autocomplete strophe_ac;
|
static Autocomplete strophe_ac;
|
||||||
static Autocomplete strophe_sm_ac;
|
static Autocomplete strophe_sm_ac;
|
||||||
static Autocomplete strophe_verbosity_ac;
|
static Autocomplete strophe_verbosity_ac;
|
||||||
|
static Autocomplete stamp_ac;
|
||||||
|
static Autocomplete stamp_unset_ac;
|
||||||
static Autocomplete adhoc_cmd_ac;
|
static Autocomplete adhoc_cmd_ac;
|
||||||
static Autocomplete lastactivity_ac;
|
static Autocomplete lastactivity_ac;
|
||||||
static Autocomplete vcard_ac;
|
static Autocomplete vcard_ac;
|
||||||
@@ -414,6 +417,8 @@ static Autocomplete* all_acs[] = {
|
|||||||
&strophe_ac,
|
&strophe_ac,
|
||||||
&strophe_sm_ac,
|
&strophe_sm_ac,
|
||||||
&strophe_verbosity_ac,
|
&strophe_verbosity_ac,
|
||||||
|
&stamp_ac,
|
||||||
|
&stamp_unset_ac,
|
||||||
&adhoc_cmd_ac,
|
&adhoc_cmd_ac,
|
||||||
&lastactivity_ac,
|
&lastactivity_ac,
|
||||||
&vcard_ac,
|
&vcard_ac,
|
||||||
@@ -1157,6 +1162,13 @@ cmd_ac_init(void)
|
|||||||
autocomplete_add(strophe_verbosity_ac, "2");
|
autocomplete_add(strophe_verbosity_ac, "2");
|
||||||
autocomplete_add(strophe_verbosity_ac, "3");
|
autocomplete_add(strophe_verbosity_ac, "3");
|
||||||
|
|
||||||
|
autocomplete_add(stamp_ac, "outgoing");
|
||||||
|
autocomplete_add(stamp_ac, "incoming");
|
||||||
|
autocomplete_add(stamp_ac, "unset");
|
||||||
|
|
||||||
|
autocomplete_add(stamp_unset_ac, "outgoing");
|
||||||
|
autocomplete_add(stamp_unset_ac, "incoming");
|
||||||
|
|
||||||
autocomplete_add(mood_ac, "set");
|
autocomplete_add(mood_ac, "set");
|
||||||
autocomplete_add(mood_ac, "clear");
|
autocomplete_add(mood_ac, "clear");
|
||||||
autocomplete_add(mood_ac, "on");
|
autocomplete_add(mood_ac, "on");
|
||||||
@@ -1379,6 +1391,7 @@ cmd_ac_init(void)
|
|||||||
g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
|
g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/statusbar", _statusbar_autocomplete);
|
g_hash_table_insert(ac_funcs, "/statusbar", _statusbar_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/strophe", _strophe_autocomplete);
|
g_hash_table_insert(ac_funcs, "/strophe", _strophe_autocomplete);
|
||||||
|
g_hash_table_insert(ac_funcs, "/stamp", _stamp_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/sub", _sub_autocomplete);
|
g_hash_table_insert(ac_funcs, "/sub", _sub_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/subject", _subject_autocomplete);
|
g_hash_table_insert(ac_funcs, "/subject", _subject_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/theme", _theme_autocomplete);
|
g_hash_table_insert(ac_funcs, "/theme", _theme_autocomplete);
|
||||||
@@ -4231,6 +4244,20 @@ _strophe_autocomplete(ProfWin* window, const char* const input, gboolean previou
|
|||||||
return autocomplete_param_with_ac(input, "/strophe", strophe_ac, FALSE, previous);
|
return autocomplete_param_with_ac(input, "/strophe", strophe_ac, FALSE, previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char*
|
||||||
|
_stamp_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
||||||
|
{
|
||||||
|
char* result = NULL;
|
||||||
|
|
||||||
|
result = autocomplete_param_with_ac(input, "/stamp unset", stamp_unset_ac, TRUE, previous);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = autocomplete_param_with_ac(input, "/stamp", stamp_ac, TRUE, previous);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
_adhoc_cmd_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
_adhoc_cmd_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2405,7 +2405,7 @@ static const struct cmd_t command_defs[] = {
|
|||||||
"/stamp unset outgoing|incoming")
|
"/stamp unset outgoing|incoming")
|
||||||
CMD_DESC("Set chat window stamp. "
|
CMD_DESC("Set chat window stamp. "
|
||||||
"The format of line in the chat window is: \"<timestamp> <encryption sign> <stamp> <message>\" "
|
"The format of line in the chat window is: \"<timestamp> <encryption sign> <stamp> <message>\" "
|
||||||
"where <stamp> is \"me:\" for incoming messages or \"username@server/resource\" for outgoing messages. "
|
"where <stamp> is \"me:\" for outgoing messages or \"username@server/resource\" for incoming messages. "
|
||||||
"This command allows to change <stamp> value.")
|
"This command allows to change <stamp> value.")
|
||||||
CMD_ARGS({ "outgoing", "Set outgoing stamp" },
|
CMD_ARGS({ "outgoing", "Set outgoing stamp" },
|
||||||
{ "incoming", "Set incoming stamp"},
|
{ "incoming", "Set incoming stamp"},
|
||||||
|
|||||||
@@ -8960,15 +8960,15 @@ gboolean
|
|||||||
cmd_stamp(ProfWin* window, const char* const command, gchar** args)
|
cmd_stamp(ProfWin* window, const char* const command, gchar** args)
|
||||||
{
|
{
|
||||||
if (g_strv_length(args) == 0) {
|
if (g_strv_length(args) == 0) {
|
||||||
auto_gchar gchar* def_incoming = prefs_get_string(PREF_OUTGOING_STAMP);
|
auto_gchar gchar* def_outgoing = prefs_get_string(PREF_OUTGOING_STAMP);
|
||||||
if (def_incoming) {
|
if (def_outgoing) {
|
||||||
cons_show("The outgoing stamp is: %s", def_incoming);
|
cons_show("The outgoing stamp is: %s", def_outgoing);
|
||||||
} else {
|
} else {
|
||||||
cons_show("The default outgoing stamp is used.");
|
cons_show("The default outgoing stamp is used.");
|
||||||
}
|
}
|
||||||
auto_gchar gchar* def_outgoing = prefs_get_string(PREF_INCOMING_STAMP);
|
auto_gchar gchar* def_incoming = prefs_get_string(PREF_INCOMING_STAMP);
|
||||||
if (def_outgoing) {
|
if (def_incoming) {
|
||||||
cons_show("The incoming stamp is: %s", def_outgoing);
|
cons_show("The incoming stamp is: %s", def_incoming);
|
||||||
} else {
|
} else {
|
||||||
cons_show("The default incoming stamp is used.");
|
cons_show("The default incoming stamp is used.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,7 +392,8 @@ chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, const char
|
|||||||
const char* display_message = plugin_message ?: message;
|
const char* display_message = plugin_message ?: message;
|
||||||
|
|
||||||
if (request_receipt && id) {
|
if (request_receipt && id) {
|
||||||
win_print_outgoing_with_receipt((ProfWin*)chatwin, enc_char, "me", display_message, id, replace_id);
|
auto_gchar gchar* outgoing_str = prefs_get_string(PREF_OUTGOING_STAMP);
|
||||||
|
win_print_outgoing_with_receipt((ProfWin*)chatwin, enc_char, outgoing_str, display_message, id, replace_id);
|
||||||
} else {
|
} else {
|
||||||
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, display_message);
|
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, display_message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ gchar*
|
|||||||
get_display_name(const ProfMessage* const message, int* flags)
|
get_display_name(const ProfMessage* const message, int* flags)
|
||||||
{
|
{
|
||||||
if (equals_our_barejid(message->from_jid->barejid)) {
|
if (equals_our_barejid(message->from_jid->barejid)) {
|
||||||
return g_strdup("me");
|
return prefs_get_string(PREF_OUTGOING_STAMP);
|
||||||
} else {
|
} else {
|
||||||
if (flags)
|
if (flags)
|
||||||
*flags = NO_ME;
|
*flags = NO_ME;
|
||||||
|
|||||||
Reference in New Issue
Block a user