[mw-devel] MW3 r1010 - trunk/src

firefury at sucs.org firefury at sucs.org
Tue Mar 18 19:54:03 GMT 2008


Author: firefury
Date: 2008-03-18 19:54:02 +0000 (Tue, 18 Mar 2008)
New Revision: 1010

Modified:
   trunk/src/incoming.c
   trunk/src/main.c
   trunk/src/rooms.c
   trunk/src/script_inst.c
   trunk/src/talker.c
   trunk/src/talker.h
   trunk/src/talker_privs.c
Log:
Sorts out the mess that happened on Outpost.
 * Gets rid of the messy talk_send() function, splitting it out into some self-contained separate functions.
 * Throws away the talk_send_mud() function completely - this means that mud announcements won't happen anymore.  If anyone cares they can be added back in when we go client/server but for now they just make stuff too messy.


Modified: trunk/src/incoming.c
===================================================================
--- trunk/src/incoming.c	2008-01-04 14:34:39 UTC (rev 1009)
+++ trunk/src/incoming.c	2008-03-18 19:54:02 UTC (rev 1010)
@@ -822,7 +822,7 @@
 			set_talk_rights();
 			user->room=newroom;
 			snprintf(text,MAXTEXTLENGTH-1,"\03310%s has just been summoned into talker room %d by %s",user->name,newroom,from);
-			talk_send(text,3,0);
+			talk_send_rawbcast(text);
 			user->chatmode=cm_flags(user->chatmode,CM_ONCHAT,CM_MODE_SET);
 
 			RoomDestroy(&myroom);
@@ -851,11 +851,11 @@
 		{
 			int o;
 			snprintf(text,MAXTEXTLENGTH-1,"\03312%s has just arrived in room %d",user->name,newroom);
-			talk_send(text,2,newroom);
+			talk_send_raw(text,newroom);
 			o=user->room;
 			user->room=(unsigned short)newroom;
 			snprintf(text,MAXTEXTLENGTH-1,"\03313%s has left to room %d",user->name, newroom);
-			talk_send(text,2,o);
+			talk_send_raw(text,o);
 			snprintf(text,MAXTEXTLENGTH-1,"\03315You have been summoned to room %d by %s.",newroom,from);
 			display_message(text, 1, 1);
 
@@ -891,7 +891,7 @@
 			snprintf(text,MAXTEXTLENGTH-1,"*** \03315%s just tried to ZoD you.",from);
 			display_message(text, 1, 1);
 			snprintf(text,MAXTEXTLENGTH-1,"\03314%s just tried to ZoD %s, and failed.",from,user->name);
-			talk_send(text,3,0);
+			talk_send_rawbcast(text);
 		}else
 		{
 			zod(from, msg);
@@ -907,7 +907,7 @@
 			snprintf(text,MAXTEXTLENGTH-1,"*** \03315%s just tried to MRoD you.",from);
 			display_message(text, 1, 1);
 			snprintf(text,MAXTEXTLENGTH-1,"\03314%s just tried to MRoD %s, and failed.",from,user->name);
-			talk_send(text,3,0);
+			talk_send_rawbcast(text);
 		}else
 		{
 			mrod(from, msg);
@@ -947,13 +947,13 @@
 
 	/* tell other people what happened */
 	snprintf(text, MAXTEXTLENGTH-1, "\03314You hear a boing in the distance");
-	talk_send(text, 2, user->room);
+	talk_send_raw(text, user->room);
 	snprintf(text, MAXTEXTLENGTH-1, "\03315%s just sent the Zebedee of Death to %s.", from, user->name);
-	talk_send(text, 2, user->room);
+	talk_send_raw(text, user->room);
 	if (msg != NULL)
 	{
 		snprintf(text, MAXTEXTLENGTH-1, "\03314\"%s\" says Zebedee", msg);
-		talk_send(text, 2, user->room);
+		talk_send_raw(text, user->room);
 	}
 
 	/* broadcast leaving message if not quiet */

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2008-01-04 14:34:39 UTC (rev 1009)
+++ trunk/src/main.c	2008-03-18 19:54:02 UTC (rev 1010)
@@ -134,9 +134,6 @@
 /* are we running it as a privaledged user */
 int god_mode(void)
 {
-	struct group *grp;
-	struct passwd *pwe;
-
 	/* old god mode, run as owner */
 	if (getuid()==geteuid()) {
 		return 1;

Modified: trunk/src/rooms.c
===================================================================
--- trunk/src/rooms.c	2008-01-04 14:34:39 UTC (rev 1009)
+++ trunk/src/rooms.c	2008-03-18 19:54:02 UTC (rev 1010)
@@ -725,7 +725,7 @@
 
 				snprintf(buff,MAXTEXTLENGTH-1,"\03312%s has arrived in room %d",user->name,where);
 				snprintf(mbuff,MAXTEXTLENGTH-1,"\03312%s has %s from %s",user->name,enter,room_name(rm, where));
-				if (!quiet) { talk_send_mud(buff,mbuff,2,where); }
+				if (!quiet) talk_send_raw(buff,where); /*talk_send_mud(buff,mbuff,2,where);*/
 				user->room=(unsigned short)where;
 				update_user(user,userposn);
 
@@ -735,7 +735,7 @@
 
 				snprintf(buff,MAXTEXTLENGTH-1,"\03313%s has left to room %d",user->name,user->room);
 				snprintf(mbuff,MAXTEXTLENGTH-1,"\03313%s has %s to %s",user->name,leave,room_name(tmp, oldroom));
-				if (!quiet) { talk_send_mud(buff,mbuff,2,oldroom); }
+				if (!quiet) talk_send_raw(buff,where); /*talk_send_mud(buff,mbuff,2,oldroom);*/
 
 				snprintf(buff,MAXTEXTLENGTH-1,"\03316Leaving %s %s to %s", rm.name, leaving, tmp.name);
 				if (!quiet) { display_message(buff, 1, 1); }
@@ -813,7 +813,7 @@
 		else
 		{
 			snprintf(buff,MAXTEXTLENGTH-1,"\03312%s has just arrived in room %d", user->name, i);
-			if (!quiet) { talk_send(buff, 2, i);}
+			if (!quiet) talk_send_raw(buff, 2, i);
 			user->room = i;
 			update_user(user, userposn);
 
@@ -822,7 +822,7 @@
 			LoadRoom(&myroom, user->room);
 
 			snprintf(buff,MAXTEXTLENGTH-1,"\03313%s has left to room %d", user->name, i);
-			if (!quiet) talk_send(buff, 2, oldroom);
+			if (!quiet) talk_send_raw(buff, 2, oldroom);
 			snprintf(buff,MAXTEXTLENGTH-1,"Leaving room %d for room %d",oldroom,user->room);
 			if (!quiet) display_message(buff, 1, 1);
 		}

Modified: trunk/src/script_inst.c
===================================================================
--- trunk/src/script_inst.c	2008-01-04 14:34:39 UTC (rev 1009)
+++ trunk/src/script_inst.c	2008-03-18 19:54:02 UTC (rev 1010)
@@ -310,17 +310,17 @@
 	else if (!strcasecmp(pc->inst->name, "shout"))
 	{
 		apply_gag(utf8buff);
-		talk_send(utf8buff, 1, user->room);
+		talk_send_shout(utf8buff);
 	}
 	else if (!strcasecmp(pc->inst->name, "emote"))
 	{
 		apply_gag(utf8buff);
-		talk_send(utf8buff, 2, user->room);
+		talk_send_emote(utf8buff, user->room, 0);
 	}
 	else if (!strcasecmp(pc->inst->name, "raw"))
 	{
 		apply_gag(utf8buff);
-		talk_send(utf8buff, 2, user->room);
+		talk_send_raw(utf8buff, user->room);
 	}
 	free(tmp);
 }

Modified: trunk/src/talker.c
===================================================================
--- trunk/src/talker.c	2008-01-04 14:34:39 UTC (rev 1009)
+++ trunk/src/talker.c	2008-03-18 19:54:02 UTC (rev 1010)
@@ -68,6 +68,7 @@
 extern int g_boTermCap;
 
 static int send_filter_oneroom(const struct person * usr, const void * info) {
+	// Everyone in the current room except people with global turned on
 	int	channel = *(int*) info;
 
 	if (! cm_flags(usr->chatmode, CM_ONCHAT, CM_MODE_ALL)) return 0;
@@ -76,7 +77,18 @@
 	return (usr->room == channel);
 }
 
+static int send_filter_nonglobal(const struct person * usr, const void * info) {
+	// Everyone outside the current room with global turned off
+	int	channel = *(int*) info;
+
+	if (! cm_flags(usr->chatmode, CM_ONCHAT, CM_MODE_ALL)) return 0;
+	if (cm_flags(usr->chatmode, CM_GLOBAL, CM_MODE_ALL)) return 0;
+	
+	return (usr->room != channel);
+}
+
 static int send_filter_global(const struct person * usr, const void * info) {
+	// Everyone outside the current room with global turned on
 	int		channel = *(int*) info;
 	int		sproof=0;
 	struct room	tmp_room;
@@ -108,6 +120,17 @@
 	ipc_send_to_all(IPC_TEXT, buff, send_filter_global, &channel);
 }
 
+void talk_send_shout(char * text){
+	char buff[MAXTEXTLENGTH];
+	
+	mwlog("SHOUT %s", text);
+	snprintf(buff, MAXTEXTLENGTH, "%s shouts %s", user->name, text);
+	ipc_send_to_all(IPC_TEXT, buff, send_filter_oneroom, &(user->room));
+	ipc_send_to_all(IPC_TEXT, buff, send_filter_nonglobal, &(user->room));
+	snprintf(buff, MAXTEXTLENGTH, "*:%s shouts %s", user->name, text);
+	ipc_send_to_all(IPC_TEXT, buff, send_filter_global, &(user->room));
+}
+
 static void talk_send_say(char * text, int channel){
 	char buff[MAXTEXTLENGTH];
 	
@@ -116,7 +139,7 @@
 	talk_send_to_room(buff, channel);
 }
 
-static void talk_send_raw(char * text, int channel){
+void talk_send_raw(char * text, int channel){
 	char buff[MAXTEXTLENGTH];
 	
 	mwlog("RAW %s", text);
@@ -124,9 +147,19 @@
 	talk_send_to_room(buff, channel);
 }
 
-static void talk_send_emote(char * text, int channel, int pleural){
+void talk_send_rawbcast(char * text){
 	char buff[MAXTEXTLENGTH];
+	
+	mwlog("RAWBCAST %s", text);
+	ipc_send_to_all(IPC_TEXT, text, send_filter_oneroom, &(user->room));
+	ipc_send_to_all(IPC_TEXT, text, send_filter_nonglobal, &(user->room));
+	snprintf(buff, MAXTEXTLENGTH, "*:%s", text);
+	ipc_send_to_all(IPC_TEXT, buff, send_filter_global, &(user->room));
+}
 
+void talk_send_emote(char * text, int channel, int pleural){
+	char buff[MAXTEXTLENGTH];
+
 	switch (pleural) {
 		case 1:
 			snprintf(buff, MAXTEXTLENGTH, "%s's %s", user->name, text);
@@ -227,7 +260,7 @@
 	user->chatmode=cm_flags(user->chatmode, CM_ONCHAT, CM_MODE_CLEAR);
 	update_user(user,userposn);
 	snprintf(text,MAXTEXTLENGTH-1,"\03311%s has just left the talker",user->name);
-	if (!quietmode) talk_send(text,3,0);	
+	if (!quietmode) talk_send_rawbcast(text);
 
 	/* announce log off talker */
 	broadcast_onoffcode(0, 0, NULL, NULL);
@@ -416,7 +449,7 @@
 	text[0]=0;
 	strncat(text, args, MAXTEXTLENGTH - strlen(text) - 1);
 	apply_gag(text);
-	talk_send(text,1,user->room);
+	talk_send_shout(text);
 }
 
 void t_whisper(CommandList *cm, int argc, char **argv, char *args)
@@ -501,7 +534,7 @@
 		}else
 		{
 			apply_gag(text);
-			talk_send(text,2,i);
+			talk_send_raw(text,i);
 		}
 	}
 	else
@@ -777,7 +810,7 @@
 		ipc_send_to_username(argv[1], IPC_CHATMODE, text);
 		snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just tried to unprotect %s",user->name,argv[1]);
 	}
-	talk_send(text,2,user->room);
+	talk_send_raw(text,user->room);
 }
 
 void t_unprotect(CommandList *cm, int argc, char **argv, char *args)
@@ -790,7 +823,7 @@
 	ipc_send_to_username(argv[1], IPC_PROTLEVEL, text);
 
 	snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just tried to unprotect %s",user->name,argv[1]);
-	talk_send(text,2,user->room);
+	talk_send_raw(text,user->room);
 }
 
 void t_summon(CommandList *cm, int argc, char **argv, char *args)
@@ -823,7 +856,7 @@
 		if (index != loop) continue;
 
 		snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just tried to summon %s to room %d",user->name,argv[loop],newroom);
-		talk_send(text,2,user->room);
+		talk_send_raw(text,user->room);
 		snprintf(text,MAXTEXTLENGTH-1,"-%05d",newroom);
 		ipc_send_to_username(argv[loop], IPC_CHANNEL, text);
 	}
@@ -836,7 +869,7 @@
 	snprintf(text,40,"+f");
 	ipc_send_to_username(argv[1], IPC_CHATMODE, text);
 	snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just tried to freeze %s",user->name,argv[1]);
-	talk_send(text,2,user->room);
+	talk_send_raw(text,user->room);
 }
 
 void t_unfreeze(CommandList *cm, int argc, char **argv, char *args)
@@ -846,7 +879,7 @@
 	snprintf(text,40,"-f");
 	ipc_send_to_username(argv[1], IPC_CHATMODE, text);
 	snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just tried to unfreeze %s",user->name,argv[1]);
-	talk_send(text,2,user->room);
+	talk_send_raw(text,user->room);
 }
 
 void t_gag(CommandList *cm, int argc, char **argv, char *args)
@@ -879,7 +912,7 @@
 
 		ipc_send_to_username(argv[1], IPC_GAG, text);
 		snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just tried to %s %s.",user->name, gag_type(type), argv[1]);
-		talk_send(text,2,user->room);
+		talk_send_raw(text,user->room);
 	}
 }
 
@@ -903,7 +936,7 @@
 
 	ipc_send_to_username(argv[1], IPC_GAG, "-12345678");
 	snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just tried to %s %s.",user->name, ungag_name(gusr.chatmode), argv[1]);
-	talk_send(text,2,user->room);
+	talk_send_raw(text,user->room);
 }
 
 void t_ignorelist(CommandList *cm, int argc, char **argv, char *args)
@@ -994,7 +1027,7 @@
 		close(wfile);
 
 		snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just ignored everyone currently logged on", user->name);
-		talk_send(text,2, user->room);
+		talk_send_raw(text,user->room);
 		snprintf(text,MAXTEXTLENGTH-1,"*** You have now ignored everyone currently logged on ***");
 		display_message(text, 1, 1);
 
@@ -1043,7 +1076,7 @@
 		else if (argloop != namecount - 1) strcat(text, ", ");
 		free(namebuff[argloop]);
 	}
-	talk_send(text,2, user->room);
+	talk_send_raw(text,user->room);
 }
  
 void t_unignore(CommandList *cm, int argc, char **argv, char *args)
@@ -1068,7 +1101,7 @@
 		}
 
 		snprintf(text,MAXTEXTLENGTH-1,"\03315%s has just un-ignored everyone", user->name);
-		talk_send(text,2, user->room);
+		talk_send_raw(text,user->room);
 		snprintf(text,MAXTEXTLENGTH-1,"*** You have unignored everyone ***");
 		display_message(text, 1, 1);
 
@@ -1128,7 +1161,7 @@
 		else if (argloop != namecount - 1)
 			strcat(text, ", ");
 	}
-	talk_send(text, 2, user->room);
+	talk_send_raw(text, user->room);
 }
 
 void t_zod(CommandList *cm, int argc, char **argv, char *args)
@@ -1226,7 +1259,7 @@
 	text[0]=0;
 	strncat(text, args, MAXTEXTLENGTH - strlen(text) - 1);
 	apply_gag(text);
-	talk_send(text,2,user->room);
+	talk_send_raw(text,user->room);
 }
 
 void t_bind(CommandList *cm, int argc, char **argv, char *args)
@@ -1318,7 +1351,7 @@
 	else
 		snprintf(mtext,MAXTEXTLENGTH-1,"\03310%s has just joined talker room %d",user->name, user->room);
 	snprintf(text,MAXTEXTLENGTH-1,"\03310%s has just joined talker room %d",user->name, user->room);
-	if (!quietmode) talk_send_mud(text,mtext,3,0);
+	if (!quietmode) talk_send_rawbcast(text); /*talk_send_mud(text,mtext,3,0);*/
 	snprintf(user->doing, DOINGSIZE-1, "Talking");
 	printf("\nNow entering the Talker. Use \".quit\" to leave and \".help\" for help.\n");
 
@@ -1385,228 +1418,6 @@
 	current_rights = RIGHTS_TALK;
 }	
 
-/* broadcast state  
-0= say: everyone in named room
-1= shout: everyone in chat
-2= raw; to named room
-3= raw broadcast; to all rooms
-*/
-void talk_send(char *text, int state, int channel) 
-{
-	char buff[MAXTEXTLENGTH];
-	char gbuff[MAXTEXTLENGTH];
-	char * sendbuff;
-	struct person u;
-	struct who w;
-	int ufile,wfile;
-	int sproof=0;
-	int global=0;
-	int sendflag;
-
-	if (user->room == channel) {
-		if (myroom.sproof>0) sproof=1;
-	} else {
-		struct room tmp_room;
-
-		RoomInit(&tmp_room);
-		if (LoadRoom(&tmp_room, channel) && (tmp_room.sproof>0)) sproof=1;
-		RoomDestroy(&tmp_room);
-	}
-
-	switch (state) {
-		case 0:
-			snprintf(buff, MAXTEXTLENGTH, "%s: %s", user->name, text);
-			if (myroom.hidden>0)
-				snprintf(gbuff, MAXTEXTLENGTH, "?:%s: %s", user->name, text);
-			else
-				snprintf(gbuff, MAXTEXTLENGTH, "%d:%s: %s", channel, user->name, text);
-			break;
-		case 1:
-			snprintf(buff, MAXTEXTLENGTH, "%s shouts: %s", user->name, text);
-			snprintf(gbuff, MAXTEXTLENGTH, "*:%s shouts: %s", user->name, text);
-			break;
-		case 2:
-			snprintf(buff, MAXTEXTLENGTH, "%s", text);
-			if (myroom.hidden>0)
-				snprintf(gbuff, MAXTEXTLENGTH, "?:%s", text);
-			else
-				snprintf(gbuff, MAXTEXTLENGTH, "%d:%s", channel, text);
-			break;
-		case 3:
-			snprintf(buff, MAXTEXTLENGTH, "%s", text);
-			snprintf(gbuff, MAXTEXTLENGTH, "*:%s", text);
-	}
-
-	wfile=openwhofile(O_RDONLY);
-	ufile=openuserfile(O_RDONLY);
-	
-	while (read(wfile,&w,sizeof(w)))
-	{
-
-		/* Skip invalid entries */
-		if (w.posn < 0)
-			continue;
-
-		lseek(ufile,w.posn,0);
-
-		read(ufile,&u,sizeof(u));
-		global=cm_flags(u.chatmode, CM_GLOBAL, CM_MODE_ALL);
-		if (global) sendbuff = gbuff;
-		else sendbuff = buff;
-
-		sendflag = 0;
-		switch (state) {
-			case 0:
-			case 2:
-				talk_send_to_room(buff, channel);
-			 	/* your room only */
-//				if (cm_flags(u.chatmode,CM_ONCHAT,CM_MODE_ALL) && (u.room==channel || (global && !sproof)))
-//					ipc_send_to_pid(w.pid, IPC_TEXT, sendbuff);
-				break;
-			case 1:
-				sendflag = 1;	// Always send, even if it's to ourself
-				// Drop through
-			case 3:
-				/* all rooms */
-				if (cm_flags(u.chatmode,CM_ONCHAT,CM_MODE_ALL))
-				{
-					if (getpid() != w.pid) sendflag = 1;
-					if (sendflag) ipc_send_to_pid(w.pid, IPC_TEXT, sendbuff);
-				}
-				break;
-		}
-	}
-
-	/* prepare log entry */
-	if (state==0) mwlog("SAY %s", text); else
-	if (state==1) mwlog("SHOUT %s", text); else
-	if (state==2) mwlog("RAW %s", text); else
-	if (state==3) mwlog("RAWBCAST %s", text);
-
-	close(ufile);
-	close(wfile);
-}
-
-/* Can't talk_send_mud() be merged with talk_send() or something?  they are almost identical */
-void talk_send_mud(char *text, char *mudtext, int state, int channel) 
-{
-	char buff[MAXTEXTLENGTH];
-	char gbuff[MAXTEXTLENGTH];
-	char mbuff[MAXTEXTLENGTH];
-	char mgbuff[MAXTEXTLENGTH];
-	struct person u;
-	struct who w;
-	int ufile,wfile;
-	struct room tmp_room;
-	int sproof=0;
-	int global;
-	int mud;
-	int sendflag;
-	char * sendbuff;
-
-	RoomInit(&tmp_room);
-	if (LoadRoom(&tmp_room, channel) && (tmp_room.sproof>0)) sproof=1;
-	RoomDestroy(&tmp_room);
-
-	switch (state) {
-		case 0:
-			snprintf(buff, MAXTEXTLENGTH, "%s: %s", user->name, text);
-			snprintf(mbuff, MAXTEXTLENGTH, "%s: %s", user->name, mudtext);
-			if (myroom.hidden>0) {
-				snprintf(gbuff, MAXTEXTLENGTH, "?:%s: %s", user->name, text);
-				snprintf(mgbuff, MAXTEXTLENGTH, "?:%s: %s", user->name, mudtext);
-			} else {
-				snprintf(gbuff, MAXTEXTLENGTH, "%d:%s: %s", channel, user->name, text);
-				snprintf(mgbuff, MAXTEXTLENGTH, "%d:%s: %s", channel, user->name, mudtext);
-			}
-			break;
-		case 1:
-			snprintf(buff, MAXTEXTLENGTH, "%s shouts: %s", user->name, text);
-			snprintf(gbuff, MAXTEXTLENGTH, "*:%s shouts: %s", user->name, text);
-			snprintf(mbuff, MAXTEXTLENGTH, "%s shouts: %s", user->name, mudtext);
-			snprintf(mgbuff, MAXTEXTLENGTH, "*:%s shouts: %s", user->name, mudtext);
-			break;
-		case 2:
-			snprintf(buff, MAXTEXTLENGTH, "%s", text);
-			snprintf(mbuff, MAXTEXTLENGTH, "%s", mudtext);
-			if (myroom.hidden>0) {
-				snprintf(gbuff, MAXTEXTLENGTH, "?:%s", text);
-				snprintf(mgbuff, MAXTEXTLENGTH, "?:%s", mudtext);
-			} else {
-				snprintf(gbuff, MAXTEXTLENGTH, "%d:%s", channel, text);
-				snprintf(mgbuff, MAXTEXTLENGTH, "%d:%s", channel, mudtext);
-			}
-			break;
-		case 3:
-			snprintf(buff, MAXTEXTLENGTH, "%s", text);
-			snprintf(gbuff, MAXTEXTLENGTH, "*:%s", text);
-			snprintf(mbuff, MAXTEXTLENGTH, "%s", mudtext);
-			snprintf(mgbuff, MAXTEXTLENGTH, "*:%s", mudtext);
-			break;
-	}
-
-	wfile=openwhofile(O_RDONLY);
-	ufile=openuserfile(O_RDONLY);
-	
-	while (read(wfile,&w,sizeof(w)))
-	{
-
-		/* Skip invalid entries */
-		if (w.posn < 0)
-			continue;
-
-		lseek(ufile,w.posn,0);
-
-		read(ufile,&u,sizeof(u));
-		global=cm_flags(u.chatmode, CM_GLOBAL, CM_MODE_ANY);
-		mud=cp_flags(u.chatprivs, CP_MUD, CM_MODE_ANY);
-		if (global) {
-			if (mud) sendbuff = mgbuff;
-			else sendbuff = gbuff;
-		} else {
-			if (mud) sendbuff = mbuff;
-			else sendbuff = buff;
-		}
-		
-		sendflag = 0;
-
-		switch (state) {
-			case 0:
-			case 2:
-				/* your room only */
-				if (cm_flags(u.chatmode,CM_ONCHAT,CM_MODE_ALL) && (u.room==channel || (global && !sproof)))
-					ipc_send_to_pid(w.pid, IPC_TEXT, sendbuff);
-				break;
-			case 1:
-				sendflag = 1;	// Always send, even if it's to ourself
-				// Drop through
-			case 3:
-				/* all rooms */
-				if (cm_flags(u.chatmode,CM_ONCHAT,CM_MODE_ALL))
-				{
-					if (getpid() != w.pid) sendflag = 1;
-					if (sendflag) ipc_send_to_pid(w.pid, IPC_TEXT, sendbuff);
-				}
-				break;
-		}
-	}
-
-	/* prepare log entry */
-	if (state==0) mwlog("SAY %s",text); else
-	if (state==1) mwlog("SHOUT %s",text); else
-	if (state==2) mwlog("RAW %s",text); else
-	if (state==3) mwlog("RAWBCAST %s",text);
-
-	/* prepare log entry for mud talk*/
-	if (state==0) mwlog("MUDSAY %s",mudtext); else
-	if (state==1) mwlog("MUDSHOUT %s",mudtext); else
-	if (state==2) mwlog("MUDRAW %s",mudtext); else
-	if (state==3) mwlog("MUDRAWBCAST %s",mudtext);
-
-	close(ufile);
-	close(wfile);
-}
-
 void talk_sayto(char *text, char *to, int channel, int exclude) 
 {
 	char buff[MAXTEXTLENGTH];

Modified: trunk/src/talker.h
===================================================================
--- trunk/src/talker.h	2008-01-04 14:34:39 UTC (rev 1009)
+++ trunk/src/talker.h	2008-03-18 19:54:02 UTC (rev 1010)
@@ -57,8 +57,10 @@
 void chat_say(char *text);
 void chat_sayto(char *to,char *text, int exclude);
 void set_talk_rights(void);
-void talk_send(char *text, int state, int channel);
-void talk_send_mud(char *text, char *mudtext, int state, int channel);
+void talk_send_emote(char * text, int channel, int pleural);
+void talk_send_rawbcast(char * text);
+void talk_send_raw(char * text, int channel);
+void talk_send_shout(char * text);
 void talk_single(char *to, char *text);
 void talk_sayto(char *text, char *to, int channel, int exclude);
 void apply_gag(char *text);

Modified: trunk/src/talker_privs.c
===================================================================
--- trunk/src/talker_privs.c	2008-01-04 14:34:39 UTC (rev 1009)
+++ trunk/src/talker_privs.c	2008-03-18 19:54:02 UTC (rev 1010)
@@ -474,7 +474,7 @@
 		display_message("*** You have been kicked off chat", 1, 1);
 
 		snprintf(text,MAXTEXTLENGTH-1,"\03311%s has just left talker",user->name);
-		if (!quietmode) talk_send(text,3,0);
+		if (!quietmode) talk_send_rawbcast(text);
 
 		set_rights();
 
@@ -493,7 +493,7 @@
 		else
 			snprintf(mtext,MAXTEXTLENGTH-1,"\03310%s has just joined talker room %d",user->name, user->room);
 		snprintf(text,MAXTEXTLENGTH-1,"\03310%s has just joined talker room %d",user->name, user->room);
-		if (!quietmode) talk_send_mud(text,mtext,3,0);
+		if (!quietmode) talk_send_rawbcast(text); /*talk_send_mud(text,mtext,3,0);*/
 
 		printf("\nNow entering the Talker. Use \".quit\" to leave and \".help\" for help.\n");
 





More information about the mw-devel mailing list