Commit 3fb9c8ef authored by Justin Mitchell's avatar Justin Mitchell
Browse files

Add replay command to mwpoll

parent 935a2738
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <special.h>
#include <perms.h>
#include <bb.h>
#include <util.h>
#include "import.h"
#include "comms.h"
#include "mwstring.h"
@@ -453,6 +454,19 @@ static int handle_command(CONNECTION *co)
		user->idletime = lastcomm;
                return 1;
        }else
        if (co->authd && strncasecmp(buff, "replay ", 7)==0) {
		AUTOFREE_BUFFER style=NULL;
		AUTOFREE_BUFFER value=NULL;
		AUTOFREE_BUFFER line = NULL;
		char *tmpu;
		style = remove_first_word(buff);
		value = remove_first_word(style);
		if ((tmpu = strchr(style, ' '))!=NULL) *tmpu=0;
		asprintf(&line, "{\"%s\":%ld}", style, atol(value));
                ipc_send_to_username(NULL, IPC_REPLAY, line);
		user->idletime = lastcomm;
                return 1;
        }else
	if (co->authd && strcasecmp(buff, "who")==0) {
		const char *line = fetch_who(0);
		if (line != NULL)