diff options
| author | dequis <dx@dxzone.com.ar> | 2016-12-27 14:24:50 -0300 | 
|---|---|---|
| committer | dequis <dx@dxzone.com.ar> | 2016-12-27 14:24:50 -0300 | 
| commit | 7801298f6a855cda0c62433d45ec717d2773ef73 (patch) | |
| tree | 0c7cfab0f55843c0f216ff7cb6130804adae4e34 /protocols | |
| parent | 9cdcef077ed523966f508a3721944a16425734cb (diff) | |
Per-account handle_unknown
Credit for the idea goes to russian XMPP spammers. Thanks!
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/account.c | 3 | ||||
| -rw-r--r-- | protocols/bee_user.c | 10 | 
2 files changed, 10 insertions, 3 deletions
| diff --git a/protocols/account.c b/protocols/account.c index 1f12f56f..b5ff4e88 100644 --- a/protocols/account.c +++ b/protocols/account.c @@ -59,6 +59,9 @@ account_t *account_add(bee_t *bee, struct prpl *prpl, char *user, char *pass)  	s = set_add(&a->set, "auto_reconnect", "true", set_eval_bool, a); +	s = set_add(&a->set, "handle_unknown", NULL, NULL, a); +	s->flags |= SET_NULL_OK; +  	s = set_add(&a->set, "nick_format", NULL, NULL, a);  	s->flags |= SET_NULL_OK; diff --git a/protocols/bee_user.c b/protocols/bee_user.c index ced92ee9..79c99ec9 100644 --- a/protocols/bee_user.c +++ b/protocols/bee_user.c @@ -169,10 +169,13 @@ void imcb_buddy_status(struct im_connection *ic, const char *handle, int flags,  	bee_user_t *bu, *old;  	if (!(bu = bee_user_by_handle(bee, ic, handle))) { -		if (g_strcasecmp(set_getstr(&ic->bee->set, "handle_unknown"), "add") == 0) { +		char *h = set_getstr(&ic->acc->set, "handle_unknown") ? : +		          set_getstr(&ic->bee->set, "handle_unknown"); + +		if (g_strncasecmp(h, "add", 3) == 0) {  			bu = bee_user_new(bee, ic, handle, BEE_USER_LOCAL);  		} else { -			if (g_strcasecmp(set_getstr(&ic->bee->set, "handle_unknown"), "ignore") != 0) { +			if (g_strcasecmp(h, "ignore") != 0) {  				imcb_log(ic, "imcb_buddy_status() for unknown handle %s:\n"  				         "flags = %d, state = %s, message = %s", handle, flags,  				         state ? state : "NULL", message ? message : "NULL"); @@ -254,7 +257,8 @@ void imcb_buddy_msg(struct im_connection *ic, const char *handle, const char *ms  	bu = bee_user_by_handle(bee, ic, handle);  	if (!bu && !(ic->flags & OPT_LOGGING_OUT)) { -		char *h = set_getstr(&bee->set, "handle_unknown"); +		char *h = set_getstr(&ic->acc->set, "handle_unknown") ? : +		          set_getstr(&ic->bee->set, "handle_unknown");  		if (g_strcasecmp(h, "ignore") == 0) {  			return; | 
