diff options
| author | Sven Moritz Hallberg <pesco@khjk.org> | 2010-06-03 23:47:53 +0200 | 
|---|---|---|
| committer | Sven Moritz Hallberg <pesco@khjk.org> | 2010-06-03 23:47:53 +0200 | 
| commit | 1dd34701541fb8142402f593dc256ff9b54121bb (patch) | |
| tree | 5a39c50aa8ba49246befa9cd22d9f9b9cf654c58 | |
| parent | bb09b3c6b8190be09e0b7c7ef2f4b1b5a69b504f (diff) | |
add an option to disable otr on twitter (and other unsuitable protocols)
| -rw-r--r-- | otr.c | 15 | ||||
| -rw-r--r-- | protocols/nogaim.h | 9 | ||||
| -rw-r--r-- | protocols/twitter/twitter.c | 1 | 
3 files changed, 21 insertions, 4 deletions
| @@ -303,6 +303,11 @@ int otr_check_for_key(account_t *a)  	irc_t *irc = a->irc;  	OtrlPrivKey *k; +	/* don't do OTR on certain (not classic IM) protocols, e.g. twitter */ +	if(a->prpl->options & OPT_NOOTR) { +		return 0; +	} +	  	k = otrl_privkey_find(irc->otr->us, a->user, a->prpl->name);  	if(k) {  		irc_usermsg(irc, "otr: %s/%s ready", a->user, a->prpl->name); @@ -324,6 +329,11 @@ char *otr_handle_message(struct im_connection *ic, const char *handle, const cha  	OtrlTLV *tlvs = NULL;  	char *colormsg; +	/* don't do OTR on certain (not classic IM) protocols, e.g. twitter */ +	if(ic->acc->prpl->options & OPT_NOOTR) { +		return (g_strdup(msg)); +	} +	  	ignore_msg = otrl_message_receiving(ic->irc->otr->us, &global.otr_ops, ic,  		ic->acc->user, ic->acc->prpl->name, handle, msg, &newmsg,  		&tlvs, NULL, NULL); @@ -370,6 +380,11 @@ int otr_send_message(struct im_connection *ic, const char *handle, const char *m  	int st;  	char *otrmsg = NULL;  	ConnContext *ctx = NULL; + +	/* don't do OTR on certain (not classic IM) protocols, e.g. twitter */ +	if(ic->acc->prpl->options & OPT_NOOTR) { +		return (ic->acc->prpl->buddy_msg(ic, handle, msg, flags)); +	}  	st = otrl_message_sending(ic->irc->otr->us, &global.otr_ops, ic,  		ic->acc->user, ic->acc->prpl->name, handle, diff --git a/protocols/nogaim.h b/protocols/nogaim.h index d3f5847f..62d800c6 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -58,6 +58,7 @@  #define OPT_LOCALBUDDY  0x00000020 /* For nicks local to one groupchat */  #define OPT_TYPING      0x00000100 /* Some pieces of code make assumptions */  #define OPT_THINKING    0x00000200 /* about these values... Stupid me! */ +#define OPT_NOOTR	0x00001000 /* protocol not suitable for OTR */  /* ok. now the fun begins. first we create a connection structure */  struct im_connection @@ -131,10 +132,10 @@ struct prpl {  	/* You should set this to the name of your protocol.  	 * - The user sees this name ie. when imcb_log() is used. */  	const char *name; -    /* Maximum Message Size of this protocol. -     * - Introduced for OTR, in order to fragment large protocol messages. -     * - 0 means "unlimited". */ -    unsigned int mms; +	/* Maximum Message Size of this protocol. +	 * - Introduced for OTR, in order to fragment large protocol messages. +	 * - 0 means "unlimited". */ +	unsigned int mms;  	/* Added this one to be able to add per-account settings, don't think  	 * it should be used for anything else. You are supposed to use the diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 98e85641..afa2fb32 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -335,6 +335,7 @@ void twitter_initmodule()  {  	struct prpl *ret = g_new0(struct prpl, 1); +	ret->options = OPT_NOOTR;  	ret->name = "twitter";  	ret->login = twitter_login;  	ret->init = twitter_init; | 
