[mw-devel] [Git][arthur/mw][master] Update mwpoll's onoff messages

Andrew Price welshbyte at sucs.org
Sun Nov 11 00:29:21 GMT 2018


Andrew Price pushed to branch master at Justin Mitchell / mw


Commits:
0aebd0af by Andrew Price at 2018-11-11T00:27:23+00:00
Update mwpoll's onoff messages

Untested.

- - - - -


4 changed files:

- src/webclient/Makefile
- src/webclient/import.c
- src/webclient/import.h
- src/webclient/mwpoll.c


Changes:

=====================================
src/webclient/Makefile
=====================================
--- a/src/webclient/Makefile
+++ b/src/webclient/Makefile
@@ -7,7 +7,10 @@ CFLAGS+= -I.. -I/usr/include/postgresql
 
 build: mwpoll
 
-mwpoll: mwpoll.o import.o comms.o mwstring.o ../libmw.a
+../client/onoff.o: ../client/onoff.c ../client/onoff.h
+	$(MAKE) -C ../client onoff.o
+
+mwpoll: mwpoll.o import.o comms.o mwstring.o ../libmw.a ../client/onoff.o
 	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
 
 clean:


=====================================
src/webclient/import.c
=====================================
--- a/src/webclient/import.c
+++ b/src/webclient/import.c
@@ -21,21 +21,6 @@ int incoming_pipe = -1;
 #define min(a,b) a<b?a:b
 #define max(a,b) a>b?a:b
 
-void broadcast_onoffcode(int code, int method, const char *sourceuser, const char *reason)
-{
-        char logofftext[MAXTEXTLENGTH];
-
-        if (reason == NULL)
-		snprintf(logofftext, MAXTEXTLENGTH - 1, "%d,%d,%d,%s",
-		         code, method, 0, sourceuser);
-	else
-		snprintf(logofftext, MAXTEXTLENGTH - 1, "%d,%d,%d,%s,%s",
-		         code, method, 0, sourceuser, reason);
-
-	logofftext[MAXTEXTLENGTH - 1] = '\0';
-        ipc_send_to_all(IPC_CHECKONOFF, logofftext);
-}
-
 void show_chatmodes(unsigned long cm, char *tmp, int flag)
 {
         int i=0;


=====================================
src/webclient/import.h
=====================================
--- a/src/webclient/import.h
+++ b/src/webclient/import.h
@@ -5,7 +5,6 @@
 
 unsigned long cm_flags(unsigned long cm, unsigned long flags, int mode);
 char *quotetext(const char *a);
-void broadcast_onoffcode(int code, int method, const char *sourceuser, const char *reason);
 void show_chatmodes(unsigned long cm, char *tmp, int flag);
 void show_chatprivs(unsigned long cp, char *tmp, int flag);
 const char *skip_first_word(const char *args);


=====================================
src/webclient/mwpoll.c
=====================================
--- a/src/webclient/mwpoll.c
+++ b/src/webclient/mwpoll.c
@@ -10,6 +10,7 @@
 #include <files.h>
 #include "import.h"
 #include "comms.h"
+#include "../client/onoff.h"
 
 struct user me;
 struct user *user = &me;
@@ -228,11 +229,10 @@ int main(int argc, char ** argv)
 	loggedin = lastcomm = loggedin;
 
 	/* spock, announce us please... */
-	//broadcast_onoffcode(3, 0, user->name, NULL);
 	if (!quietentry) {
 	  talk_rawbcast("\03310%s has just joined web talker room %d", me.record.name, me.record.room);
 	}
-	broadcast_onoffcode(1, 0, me.record.name, NULL);
+	announce_logon(me.record.name, ONOFF_LOGON, quietentry);
 
 	/* the main loop */
 	while (mainloop(1000)==0) {
@@ -255,24 +255,7 @@ int main(int argc, char ** argv)
 	if (!quietentry) {
 	  talk_rawbcast("\03311%s has just left the web talker", me.record.name);
 	}
-	broadcast_onoffcode(0,0,me.record.name,NULL);
-#if 0
-	switch (die) {
-		case 1: /* requested logout */
-			broadcast_onoffcode(2, 0, user->name, NULL);
-			break;
-		case 2: /* idle out */
-			broadcast_onoffcode(2, 1, user->name, NULL);
-			break;
-		case 3: /* mrod/zod */
-			broadcast_onoffcode(2, 3, user->name, NULL);
-			break;
-		default:
-			broadcast_onoffcode(2, 0, user->name, NULL);
-			break;
-	}
-#endif
-
+	announce_logoff(me.record.name, LOGOFF_NORMAL, NULL, NULL, quietentry);
 	me.record.idletime=time(0);
 	update_user(&me);
 	ipc_close();



View it on GitLab: https://projects.sucs.org/arthur/mw/commit/0aebd0af0862a86f99e935421f95940f83de1a70

-- 
View it on GitLab: https://projects.sucs.org/arthur/mw/commit/0aebd0af0862a86f99e935421f95940f83de1a70
You're receiving this email because of your account on projects.sucs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/mw-devel/attachments/20181111/f183d204/attachment-0001.html>


More information about the mw-devel mailing list