From 52146947c174603c2654e80ab88bbdae0a6c6097 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 29 Jun 2012 14:40:57 +0900 Subject: [PATCH] First part of chat info support. The idea is to allow other clients know when the player is chatting, fiddling with the console, etc. --- qw/include/cl_chat.h | 1 + qw/include/client.h | 1 + qw/source/cl_chat.c | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/qw/include/cl_chat.h b/qw/include/cl_chat.h index 2a26c075a..4fb3eab17 100644 --- a/qw/include/cl_chat.h +++ b/qw/include/cl_chat.h @@ -38,5 +38,6 @@ void CL_Chat_User_Disconnected (int uid); void CL_Chat_Check_Name (const char *name, int slot); void CL_Chat_Flush_Ignores (void); void CL_Chat_Init (void); +void CL_ChatInfo (int val); #endif diff --git a/qw/include/client.h b/qw/include/client.h index e6446f0f5..c65fded9e 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -136,6 +136,7 @@ typedef struct { // private userinfo for sending to masterless servers struct info_s *userinfo; + int chat; // file transfer from server QFile *download; diff --git a/qw/source/cl_chat.c b/qw/source/cl_chat.c index 90cb4d8be..392a05df0 100644 --- a/qw/source/cl_chat.c +++ b/qw/source/cl_chat.c @@ -35,11 +35,14 @@ # include #endif -#include "QF/info.h" -#include "QF/dstring.h" -#include "QF/llist.h" +#include "QF/cbuf.h" #include "QF/cmd.h" +#include "QF/dstring.h" +#include "QF/info.h" +#include "QF/llist.h" #include "QF/sys.h" +#include "QF/va.h" + #include "client.h" #include "cl_chat.h" @@ -231,3 +234,14 @@ CL_Chat_Init (void) Cmd_AddCommand ("ignore", CL_Ignore_f, "Ignores chat and name-change messages from a user."); Cmd_AddCommand ("unignore", CL_Unignore_f, "Removes a previously ignored user from the ignore list."); } + +void +CL_ChatInfo (int val) +{ + if (val < 1 || val > 3) + val = 0; + if (cls.chat != val) { + cls.chat = val; + Cbuf_AddText(cl_cbuf, va ("setinfo chat \"%d\"\n", val)); + } +}