shithub: xmpp

ref: ed2752fe715680692023bbcaf85ddf03c2444c2c
dir: xmpp/xmpp.h

View raw version
typedef struct Target Target;
struct Target
{
	int  type;
	char *name;
	char *jid;
	union
	{
		struct
		{
			int  width;
			int  numents;
			char *subj;
		}muc;
		struct
		{
			Target *room;
			int    aff;
			int    role;
			char   *jid;
			char   *show;
		}mucent;
		struct
		{
			char *show;
			int  subscr;
			int  flags;
		}rost;
	};
};

#pragma varargck type "t" Target*

enum
{
	Anone = 0,
	Aowner,
	Aadmin,
	Amember,
	Aoutcast,

	Rnone = 0,
	Rmoder,
	Rpart,
	Rvisit,

	Emuc = 0,
	Emucent,
	Erost,

	Fonline = 1<<0,
	Fasked = 1<<1,
};

extern char *server, *mydomain, *myjid, *mynick, *myresource;
extern int debug, nopresence, nohistory, plainallow;
extern Target **targets;
extern int curr, numtargets;
extern char *enttypes[];

/* conn.c */
int connect(Biobuf *b, char *user, char *passwd);

/* muc.c */
void mucpresence(Xelem *xml, Target *room, Xattr *from);
int mucbookmarks(Xelem *e, int fd);
int cmdaff(int fd, int argc, char **argv);
int cmdbookmark(int fd, int argc, char **argv);
int cmdjoin(int fd, int argc, char **argv);
int cmdpart(int fd, int argc, char **argv);
int cmdwho(int, int argc, char **argv);
int cmdnick(int fd, int argc, char **argv);
int cmdsubj(int fd, int argc, char **argv);

/* rost.c */
int rostupdate(Xelem *x, int fd);
int rostsubscr(char *from, char *type, int fd);
void rostpresence(Xelem *x, Target *t);
int cmdroster(int fd, int argc, char **argv);

/* misc.c */
char *strtime(void);
char *strenttime(char **tzo);
void cleaninput(int n);
void setlabel(char *label, char *prsuffix);
char *strstamp(char *v);
char *readlines(void);

/* targ.c */
int targmatches(Target *t, char *s, int n);
Target *addtarget(int type, char *name);
void rmtarget(Target *t);
int cmdtarget(int, int argc, char **argv);
#pragma varargck type "t" Target*
int targetfmt(Fmt *f);