aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorSteffen Jaeckel <jaeckel-floss@eyet-services.de>2022-12-27 22:53:18 +0100
committerSteffen Jaeckel <jaeckel-floss@eyet-services.de>2023-01-18 20:02:46 +0100
commita0aa26b6fa65ba625f4a6d3495a345c7120ff16d (patch)
tree551898690f72084567206cd95a325a6f16c577ab /src/command
parenta45f05a45e7daceab95af4daa0f661874a3bd057 (diff)
downloadprofani-tty-a0aa26b6fa65ba625f4a6d3495a345c7120ff16d.tar.gz
add `now` option to `/reconnect` command
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_defs.c8
-rw-r--r--src/command/cmd_funcs.c14
2 files changed, 13 insertions, 9 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 6b494e1a..fb37341d 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -1936,11 +1936,13 @@ static const struct cmd_t command_defs[] = {
CMD_TAGS(
CMD_TAG_CONNECTION)
CMD_SYN(
- "/reconnect <seconds>")
+ "/reconnect <seconds>",
+ "/reconnect now")
CMD_DESC(
- "Set the reconnect attempt interval for when the connection is lost.")
+ "Set the reconnect attempt interval for when the connection is lost or immediately trigger a reconnect.")
CMD_ARGS(
- { "<seconds>", "Number of seconds before attempting to reconnect, a value of 0 disables reconnect." })
+ { "<seconds>", "Number of seconds before attempting to reconnect, a value of 0 disables reconnect." },
+ { "now", "Immediately trigger a reconnect." })
},
{ CMD_PREAMBLE("/autoping",
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index a97240ff..bbfb3cb8 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -82,16 +82,17 @@
#include "plugins/plugins.h"
#include "ui/ui.h"
#include "ui/window_list.h"
-#include "xmpp/xmpp.h"
+#include "xmpp/avatar.h"
+#include "xmpp/chat_session.h"
#include "xmpp/connection.h"
#include "xmpp/contact.h"
-#include "xmpp/roster_list.h"
#include "xmpp/jid.h"
#include "xmpp/muc.h"
-#include "xmpp/chat_session.h"
-#include "xmpp/avatar.h"
+#include "xmpp/roster_list.h"
+#include "xmpp/session.h"
#include "xmpp/stanza.h"
#include "xmpp/vcard_funcs.h"
+#include "xmpp/xmpp.h"
#ifdef HAVE_LIBOTR
#include "otr/otr.h"
@@ -6539,8 +6540,9 @@ cmd_reconnect(ProfWin* window, const char* const command, gchar** args)
int intval = 0;
char* err_msg = NULL;
- gboolean res = strtoi_range(value, &intval, 0, INT_MAX, &err_msg);
- if (res) {
+ if (g_strcmp0(value, "now") == 0) {
+ session_reconnect_now();
+ } else if (strtoi_range(value, &intval, 0, INT_MAX, &err_msg)) {
prefs_set_reconnect(intval);
if (intval == 0) {
cons_show("Reconnect disabled.", intval);