~ft/xmpp

ed2752fe715680692023bbcaf85ddf03c2444c2c — Sigrid Solveig Haflínudóttir 5 months ago d88eb3a master
preserve original jid verbatim for matching with "to" (thanks binarycat)
1 files changed, 7 insertions(+), 2 deletions(-)

M xmpp.c
M xmpp.c => xmpp.c +7 -2
@@ 21,7 21,7 @@ static char lastid[32];

int debug, nopresence, nohistory, plainallow;
Biobuf kbin;
char *server, *mydomain, *myjid, *mynick, *myresource;
char *server, *mydomain, *myjid, *mynick, *myresource, *myplainjid;
static QLock prlock;

static void


@@ 59,7 59,8 @@ inmsg(Xelem *x)
		return;

	to = xmlgetattr(x->a, "to");
	if(to != nil && strncmp(to->v, myjid, strlen(myjid)) != 0)
	if(to != nil && strncmp(to->v, myjid, strlen(myjid)) != 0 && 
			strncmp(to->v, myplainjid, strlen(myplainjid) != 0))
		return;

	if((delay = xmlget(x->ch, "delay")) == nil)


@@ 475,6 476,10 @@ threadmain(int argc, char **argv)
	if(argc != 1)
		usage();
	myjid = strdup(argv[0]);
	/* myjid will get set later to a value given by the server,
	 * but sometimes that value isn't used, so we also
	 * check against the old value */
	myplainjid = strdup(myjid);

	quotefmtinstall();
	fmtinstall('H', encodefmt);