Loading src/server/replay.c +49 −6 Original line number Diff line number Diff line Loading @@ -102,12 +102,57 @@ static int write_message(ipc_message_t *msg, unsigned n) return 0; } static int msg_storeable(enum ipc_types type) { switch (type) { case IPC_NOOP: case IPC_NEWMAIL: case IPC_STATUS: case IPC_GROUPS: case IPC_REALNAME: case IPC_CONTACT: case IPC_LASTREAD: case IPC_SPECIAL: case IPC_TIMEOUT: case IPC_USERNAME: case IPC_CHATPRIVS: case IPC_CHATMODE: case IPC_KICK: case IPC_PASSWD: case IPC_CHANNEL: case IPC_GAG: case IPC_GAGLIST: case IPC_SCRIPTIPC: case IPC_SCRIPTRPC: case IPC_PROTLEVEL: case IPC_PROTPOWER: case IPC_DOING: return 0; case IPC_TEXT: case IPC_WIZ: case IPC_CHECKONOFF: case IPC_ERROR: case IPC_HELLO: case IPC_UPTIME: case IPC_SAYTOROOM: case IPC_SAYTOUSER: case IPC_SAYTOALL: case IPC_TALKERROR: case IPC_REPLAY: case IPC_EVENT: case IPC_ACTION: case IPC_WHOLIST: return 1; default: return 0; } } /* store the message for later replay */ void store_message(ipc_message_t *msg) { /* only store info/message, not actions */ if (msg->head.type <= 26 && !( msg->head.type == IPC_TEXT || msg->head.type == IPC_WIZ)) if (!msg_storeable(msg->head.type)) return; if (store_len >= STORE_SIZE) { Loading Loading @@ -201,8 +246,8 @@ void replay(ipc_connection_t *conn, ipc_message_t *msg) int idx = store_wrap( oldest + i ); if (store[idx] == NULL) continue; store[idx]->flags |= IPCMSG_FL_REPLAY; /* this will be a subset of what you see in process_msg() */ if (store[idx]->head.type == IPC_SAYTOROOM) { json_t * j = json_init( store[idx] ); if (j == NULL) continue; Loading Loading @@ -252,9 +297,7 @@ void replay(ipc_connection_t *conn, ipc_message_t *msg) if (store[idx]->head.dst) msg_attach(store[idx], conn); } RoomDestroy(&user.room); return; } Loading src/socket.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ typedef struct { typedef struct { ipc_msghead_t head; uint32_t format; #define IPCMSG_FL_REPLAY 0x00000001 uint32_t flags; int bodylen; int refcount; Loading Loading
src/server/replay.c +49 −6 Original line number Diff line number Diff line Loading @@ -102,12 +102,57 @@ static int write_message(ipc_message_t *msg, unsigned n) return 0; } static int msg_storeable(enum ipc_types type) { switch (type) { case IPC_NOOP: case IPC_NEWMAIL: case IPC_STATUS: case IPC_GROUPS: case IPC_REALNAME: case IPC_CONTACT: case IPC_LASTREAD: case IPC_SPECIAL: case IPC_TIMEOUT: case IPC_USERNAME: case IPC_CHATPRIVS: case IPC_CHATMODE: case IPC_KICK: case IPC_PASSWD: case IPC_CHANNEL: case IPC_GAG: case IPC_GAGLIST: case IPC_SCRIPTIPC: case IPC_SCRIPTRPC: case IPC_PROTLEVEL: case IPC_PROTPOWER: case IPC_DOING: return 0; case IPC_TEXT: case IPC_WIZ: case IPC_CHECKONOFF: case IPC_ERROR: case IPC_HELLO: case IPC_UPTIME: case IPC_SAYTOROOM: case IPC_SAYTOUSER: case IPC_SAYTOALL: case IPC_TALKERROR: case IPC_REPLAY: case IPC_EVENT: case IPC_ACTION: case IPC_WHOLIST: return 1; default: return 0; } } /* store the message for later replay */ void store_message(ipc_message_t *msg) { /* only store info/message, not actions */ if (msg->head.type <= 26 && !( msg->head.type == IPC_TEXT || msg->head.type == IPC_WIZ)) if (!msg_storeable(msg->head.type)) return; if (store_len >= STORE_SIZE) { Loading Loading @@ -201,8 +246,8 @@ void replay(ipc_connection_t *conn, ipc_message_t *msg) int idx = store_wrap( oldest + i ); if (store[idx] == NULL) continue; store[idx]->flags |= IPCMSG_FL_REPLAY; /* this will be a subset of what you see in process_msg() */ if (store[idx]->head.type == IPC_SAYTOROOM) { json_t * j = json_init( store[idx] ); if (j == NULL) continue; Loading Loading @@ -252,9 +297,7 @@ void replay(ipc_connection_t *conn, ipc_message_t *msg) if (store[idx]->head.dst) msg_attach(store[idx], conn); } RoomDestroy(&user.room); return; } Loading
src/socket.h +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ typedef struct { typedef struct { ipc_msghead_t head; uint32_t format; #define IPCMSG_FL_REPLAY 0x00000001 uint32_t flags; int bodylen; int refcount; Loading