=== modified file 'otr.c' --- otr.c 2009-03-13 11:31:47 +0000 +++ otr.c 2009-10-02 01:41:18 +0000 @@ -370,6 +371,7 @@ int st; char *otrmsg = NULL; ConnContext *ctx = NULL; + user_t *u; st = otrl_message_sending(ic->irc->otr->us, &global.otr_ops, ic, ic->acc->user, ic->acc->prpl->name, handle, @@ -382,7 +384,14 @@ handle, ic->acc->user, ic->acc->prpl->name, 1, NULL, NULL, NULL); - if(otrmsg) { + /* lookup the user_t for the given recipient */ + u = user_findhandle(ic, handle); + /* we'll just assume that illegal handles would have been caught by now */ + if (!u) + return -1; + + /* only use encryption when recipient is online */ + if(u->online && otrmsg) { if(!ctx) { otrl_message_free(otrmsg); return 1;