Changeset 7801298 for protocols


Ignore:
Timestamp:
2016-12-27T17:24:50Z (8 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
2e8523b
Parents:
9cdcef0
Message:

Per-account handle_unknown

Credit for the idea goes to russian XMPP spammers. Thanks!

Location:
protocols
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/account.c

    r9cdcef0 r7801298  
    5959
    6060        s = set_add(&a->set, "auto_reconnect", "true", set_eval_bool, a);
     61
     62        s = set_add(&a->set, "handle_unknown", NULL, NULL, a);
     63        s->flags |= SET_NULL_OK;
    6164
    6265        s = set_add(&a->set, "nick_format", NULL, NULL, a);
  • protocols/bee_user.c

    r9cdcef0 r7801298  
    170170
    171171        if (!(bu = bee_user_by_handle(bee, ic, handle))) {
    172                 if (g_strcasecmp(set_getstr(&ic->bee->set, "handle_unknown"), "add") == 0) {
     172                char *h = set_getstr(&ic->acc->set, "handle_unknown") ? :
     173                          set_getstr(&ic->bee->set, "handle_unknown");
     174
     175                if (g_strncasecmp(h, "add", 3) == 0) {
    173176                        bu = bee_user_new(bee, ic, handle, BEE_USER_LOCAL);
    174177                } else {
    175                         if (g_strcasecmp(set_getstr(&ic->bee->set, "handle_unknown"), "ignore") != 0) {
     178                        if (g_strcasecmp(h, "ignore") != 0) {
    176179                                imcb_log(ic, "imcb_buddy_status() for unknown handle %s:\n"
    177180                                         "flags = %d, state = %s, message = %s", handle, flags,
     
    255258
    256259        if (!bu && !(ic->flags & OPT_LOGGING_OUT)) {
    257                 char *h = set_getstr(&bee->set, "handle_unknown");
     260                char *h = set_getstr(&ic->acc->set, "handle_unknown") ? :
     261                          set_getstr(&ic->bee->set, "handle_unknown");
    258262
    259263                if (g_strcasecmp(h, "ignore") == 0) {
Note: See TracChangeset for help on using the changeset viewer.