Commit 8e9579cb authored by Andrew Price's avatar Andrew Price
Browse files

Fix timestamps on gag messages

Fixes #33
parent 4dd8cd35
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ void accept_action(ipc_connection_t *conn, ipc_message_t *msg)
		}

		ipc_message_t * event = ipcmsg_create(IPC_EVENT, msg->head.src);
		event->head.when = msg->head.when;
		ipcmsg_destination(event, -1);
		json_t * ej = json_init(NULL);
		json_addstring(ej, "target", victim_name);
@@ -190,12 +191,14 @@ void accept_action(ipc_connection_t *conn, ipc_message_t *msg)
			_autofree char *buff=NULL;
			asprintf(&buff,"+%d", gtnum);
			ipc_message_t *update = ipcmsg_create(IPC_GAG, msg->head.src);
			update->head.when = msg->head.when;
			ipcmsg_destination(update, toid);
			ipcmsg_append(update, buff, strlen(buff));
			msg_attach_to_username(update, victim_name);
			ipcmsg_destroy(update);

			ipc_message_t *gm = ipcmsg_create(IPC_EVENT, msg->head.src);
			update->head.when = msg->head.when;
			json_t * gj = json_init(NULL);
			json_addstring(gj, "target", victim_name);
			json_addint(gj, "success", success);
@@ -218,6 +221,7 @@ void accept_action(ipc_connection_t *conn, ipc_message_t *msg)

	if (strcasecmp(command, "ungag")==0) {
		ipc_message_t * event = ipcmsg_create(IPC_EVENT, msg->head.src);
		event->head.when = msg->head.when;
		ipcmsg_destination(event, -1);
		json_t * ej = json_init(NULL);
		json_addstring(ej, "target", victim_name);
@@ -235,12 +239,14 @@ void accept_action(ipc_connection_t *conn, ipc_message_t *msg)
			_autofree char *buff=NULL;
			asprintf(&buff,"-");
			ipc_message_t *update = ipcmsg_create(IPC_GAG, msg->head.src);
			update->head.when = msg->head.when;
			ipcmsg_destination(update, toid);
			ipcmsg_append(update, buff, strlen(buff));
			msg_attach_to_username(update, victim_name);
			ipcmsg_destroy(update);

			ipc_message_t *gm = ipcmsg_create(IPC_EVENT, msg->head.src);
			update->head.when = msg->head.when;
			json_t * gj = json_init(NULL);
			json_addstring(gj, "target", victim_name);
			json_addint(gj, "success", success);