shithub: mez

ref: a4d0372d0f1916d1d9df34c4fe4ae7a98c8de020
dir: /mez.h/

View raw version
typedef struct App App;
typedef struct Chan Chan;
typedef struct Net Net;
typedef struct Text Text;
typedef struct Msg Msg;

struct App {
	char *host, *user, *passwd;
};

// The multiple indirection for the screen is because
// multiple texts may share the same screen.
struct Text {
	Frame;
	Rune *text;
	uint textlen, topline, nlines, linescap, textcap, *lines;
	Rectangle scrollr, bodyr;
	Image **screen, *cols[NCOL];
	Screen **_screen;
	char *wsys;
};

struct Chan {
	Text body, nicks;
	Rune *topic;
};

struct Net {
	Chan;
	char *name, *host, *state, *nick, *user, *real;
	Chan *channels;
	int fd, id;
	char in[8192], out[8192];
};

enum {
	PRIVMSG = 1000,
};

struct Msg {
	int t;
	char *sender;
	union {
		char *dst;
		char *msg;
	}; // PRIVMSG
};

void error(char*);
void *emallocz(ulong sz, int clr);
void *erealloc(void *ptr, ulong size);