Commit d725e0a5 authored by Justin Mitchell's avatar Justin Mitchell
Browse files

Goodbye who.bb, gone forever, and good riddance

parent 3fb9c8ef
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@ Milliways III installation notes
    the libdir and bindir variables in Makefile as appropriate. `make install'
    will create a subdirectory of libdir called `mw' under which it will place
    all the files needed by Milliways to run (apart from users.bb which is
    created when mw is first run, and who.bb which you must create yourself, as
    below). It will also put a copy of the mw executable under bindir.
    created when mw is first run. It will also put a copy of the mw executable
    under bindir.

    To build, cd to the src subdirectory and type `make'.

+0 −1
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#pragma GCC diagnostic warning "-Winvalid-offsetof"
#pragma GCC diagnostic warning "-Wstrict-prototypes"

#include <who.h>
#include <sqlite.h>
#include <iconv.h>
#include "bb.h"
+0 −2
Original line number Diff line number Diff line
@@ -470,8 +470,6 @@ int main(int argc, char **argv)
		printf(_("  -new        Summary of new messages and quit\n"));
		printf(_("  -server <a> Connect to server <a>\n"));
		printf(_("  -since      Lists people logged on between now and when you last logged on\n"));
		printf(_("  -who        Show a list of users logged on and quit\n"));
		printf(_("  -what       Show a list of what users are doing\n"));
		/*
		printf("  -quiet              Don't announce your login to board or talker\n");
		printf("  -X <user>           Display messages for that user\n");
+1 −1
Original line number Diff line number Diff line
@@ -419,7 +419,7 @@ void scr_roomnum( struct code *pc, int fargc, char **fargv )
			const char *name = json_getstring(entry, "name");
			const char *chatmode = NULL;
			if (perms!=NULL) chatmode=json_getstring(perms, "chatmode");
			int room = json_getint(entry, "room");
			int room = json_getint(entry, "channel");

			/* wrong person */
			if (strcasecmp(name, uname)!=0) continue;
+19 −2
Original line number Diff line number Diff line
@@ -134,8 +134,6 @@ void update_wholist(ipc_message_t *msg)
	whoinfo = json_init(msg);
	whowhen = time(NULL);

	printf("Received whodata = %s\n", msg->body);

	/* we were waiting for one, show it */
	if (whotype >= 0) {
		display_wholist(whotype);
@@ -252,3 +250,22 @@ json_t * grab_wholist(void)
	if (whoinfo != NULL) json_incref(whoinfo);
	return whoinfo;
}

int32_t who_find(const char *username)
{
	json_t *wlist = grab_wholist();
	if (wlist == NULL) return -1;

	size_t wi;
	json_t *entry;
	json_array_foreach(wlist, wi, entry) {
		const char *name = json_getstring(entry, "name");
		int32_t uid = json_getint(entry, "id");
		if (strcasecmp(username, name)==0) {
			json_decref(wlist);
			return uid;
		}
	}
	json_decref(wlist);
	return -1;
}
Loading