Commit 0aebd0af authored by Andrew Price's avatar Andrew Price
Browse files

Update mwpoll's onoff messages

Untested.
parent df189737
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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:
+0 −15
Original line number Diff line number Diff line
@@ -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;
+0 −1
Original line number Diff line number Diff line
@@ -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);
+3 −20
Original line number Diff line number Diff line
@@ -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();