Loading src/server/servsock.c +15 −42 Original line number Diff line number Diff line Loading @@ -359,10 +359,6 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) * all below this point are intended to be retransmitted */ /* set the unique serial number and timestamp */ assign_serial(msg); store_message(msg); /* load sender */ struct user from; fetch_user(&from, conn->user); Loading @@ -374,12 +370,8 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) const char * exclude = json_getstring(j, "exclude"); msg_attach_to_channel(msg, msg->head.dst, exclude); json_decref(j); ipcmsg_destroy(msg); return; } } else if (msg->head.type == IPC_SAYTOUSER) { /* message is for a specific username */ if (msg->head.type == IPC_SAYTOUSER) { msg_apply_gag(&from, msg, "text"); /* eventually this should be a server maintained list */ json_t * j = json_init(msg); Loading @@ -388,15 +380,9 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) send_error(conn, msg, "User '%s' not found", target); } json_decref(j); ipcmsg_destroy(msg); return; } } else if (msg->head.type == IPC_SAYTOALL) { /* send message to everyone (unless this room is soundproof) */ if (msg->head.type == IPC_SAYTOALL) { msg_apply_gag(&from, msg, "text"); /* load the senders room to see if its soundproof */ struct room room; RoomInit(&room); Loading @@ -410,42 +396,29 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) msg->head.type = IPC_SAYTOROOM; msg->head.dst = from.record.room; msg_attach_to_channel(msg, room.num, NULL); printf("Shout in soundproof room (%d) change to SAYTORROM %d\n", printf("Shout in soundproof room (%d) change to SAYTOROOM %d\n", room.sproof, from.record.room); } else { msg_attach_to_all(msg); } RoomDestroy(&room); ipcmsg_destroy(msg); return; } if (msg->head.type == IPC_EVENT) { } else if (msg->head.type == IPC_EVENT) { printf("Event message\n"); msg_attach_to_all(msg); ipcmsg_destroy(msg); return; } if (msg->head.type == IPC_WIZ) { } else if (msg->head.type == IPC_WIZ) { printf("Wiz message\n"); msg_attach_to_perm(msg, PERM_WIZCHAT); ipcmsg_destroy(msg); return; } } else if (msg->head.dst == SYSTEM_USER) { /* it was a broadcast message */ if (msg->head.dst == SYSTEM_USER) { printf("Broadcast message to system user %s\n", ipc_nametype(msg->head.type)); msg_attach_to_all(msg); ipcmsg_destroy(msg); return; } } else { /* otherwise redistribute this message to intended target */ printf("Unhandled direct-to-user command %s\n", ipc_nametype(msg->head.type)); msg_attach_to_userid(msg, msg->head.dst); } assign_serial(msg); store_message(msg); ipcmsg_destroy(msg); } Loading Loading
src/server/servsock.c +15 −42 Original line number Diff line number Diff line Loading @@ -359,10 +359,6 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) * all below this point are intended to be retransmitted */ /* set the unique serial number and timestamp */ assign_serial(msg); store_message(msg); /* load sender */ struct user from; fetch_user(&from, conn->user); Loading @@ -374,12 +370,8 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) const char * exclude = json_getstring(j, "exclude"); msg_attach_to_channel(msg, msg->head.dst, exclude); json_decref(j); ipcmsg_destroy(msg); return; } } else if (msg->head.type == IPC_SAYTOUSER) { /* message is for a specific username */ if (msg->head.type == IPC_SAYTOUSER) { msg_apply_gag(&from, msg, "text"); /* eventually this should be a server maintained list */ json_t * j = json_init(msg); Loading @@ -388,15 +380,9 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) send_error(conn, msg, "User '%s' not found", target); } json_decref(j); ipcmsg_destroy(msg); return; } } else if (msg->head.type == IPC_SAYTOALL) { /* send message to everyone (unless this room is soundproof) */ if (msg->head.type == IPC_SAYTOALL) { msg_apply_gag(&from, msg, "text"); /* load the senders room to see if its soundproof */ struct room room; RoomInit(&room); Loading @@ -410,42 +396,29 @@ void process_msg(ipc_connection_t *conn, ipc_message_t *msg) msg->head.type = IPC_SAYTOROOM; msg->head.dst = from.record.room; msg_attach_to_channel(msg, room.num, NULL); printf("Shout in soundproof room (%d) change to SAYTORROM %d\n", printf("Shout in soundproof room (%d) change to SAYTOROOM %d\n", room.sproof, from.record.room); } else { msg_attach_to_all(msg); } RoomDestroy(&room); ipcmsg_destroy(msg); return; } if (msg->head.type == IPC_EVENT) { } else if (msg->head.type == IPC_EVENT) { printf("Event message\n"); msg_attach_to_all(msg); ipcmsg_destroy(msg); return; } if (msg->head.type == IPC_WIZ) { } else if (msg->head.type == IPC_WIZ) { printf("Wiz message\n"); msg_attach_to_perm(msg, PERM_WIZCHAT); ipcmsg_destroy(msg); return; } } else if (msg->head.dst == SYSTEM_USER) { /* it was a broadcast message */ if (msg->head.dst == SYSTEM_USER) { printf("Broadcast message to system user %s\n", ipc_nametype(msg->head.type)); msg_attach_to_all(msg); ipcmsg_destroy(msg); return; } } else { /* otherwise redistribute this message to intended target */ printf("Unhandled direct-to-user command %s\n", ipc_nametype(msg->head.type)); msg_attach_to_userid(msg, msg->head.dst); } assign_serial(msg); store_message(msg); ipcmsg_destroy(msg); } Loading