Changeset 7882a6f in code for icb.c


Ignore:
Timestamp:
Mar 10, 2014, 12:13:22 PM (11 years ago)
Author:
Mike Belopuhov <mike@…>
Branches:
master
Children:
fe81e9a
Parents:
e80f9fc
Message:

Get rid of the icbd callbacks interface

I believe the idea was initially to have both icb and irc in one
daemon but that's not going to happen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icb.c

    re80f9fc r7882a6f  
    4343 */
    4444void
    45 icb_init(struct icbd_callbacks *ic)
    46 {
    47         icb_drop = ic->drop;
    48         icb_log = ic->log;
    49         icb_send = ic->send;
    50 
     45icb_init(void)
     46{
    5147        LIST_INIT(&groups);
    5248
     
    9894                if (strlen(cmd) > 0 && cmd[0] == 'w') {
    9995                        icb_error(is, "Command not implemented");
    100                         icb_drop(is, NULL);
     96                        icbd_drop(is, NULL);
    10197                        return;
    10298                }
    10399                if (strlen(cmd) == 0 || strcmp(cmd, "login") != 0) {
    104100                        icb_error(is, "Malformed login packet");
    105                         icb_drop(is, NULL);
     101                        icbd_drop(is, NULL);
    106102                        return;
    107103                }
     
    152148            icb_vis(is->nick, nick, ICB_MAXNICKLEN, VIS_SP)) {
    153149                icb_error(is, "Invalid nick");
    154                 icb_drop(is, NULL);
     150                icbd_drop(is, NULL);
    155151                return;
    156152        }
     
    166162                if (!creategroups) {
    167163                        icb_error(is, "Invalid group %s", group);
    168                         icb_drop(is, NULL);
     164                        icbd_drop(is, NULL);
    169165                        return;
    170166                } else {
     
    173169                                return;
    174170                        }
    175                         icb_log(NULL, LOG_DEBUG, "%s created group %s",
     171                        icbd_log(NULL, LOG_DEBUG, "%s created group %s",
    176172                            is->nick, group);
    177173                }
     
    180176                if (strcmp(s->nick, is->nick) == 0) {
    181177                        icb_error(is, "Nick is already in use");
    182                         icb_drop(is, NULL);
     178                        icbd_drop(is, NULL);
    183179                        return;
    184180                }
     
    238234                if (s == is)
    239235                        continue;
    240                 icb_send(s, buf, buflen + 1);
     236                icbd_send(s, buf, buflen + 1);
    241237        }
    242238}
     
    321317                break;
    322318        default:
    323                 icb_log(is, LOG_ERR, "unknown cmdout type");
     319                icbd_log(is, LOG_ERR, "unknown cmdout type %d", type);
    324320                return;
    325321        }
     
    367363        buf[0] = buflen;
    368364        va_end(ap);
    369         icb_send(is, buf, buflen + 1);
     365        icbd_send(is, buf, buflen + 1);
    370366}
    371367
     
    390386        }
    391387        logger(ig->name, "", buf);
    392         icb_log(NULL, LOG_DEBUG, "%s", buf);
     388        icbd_log(NULL, LOG_DEBUG, "%s", buf);
    393389        va_end(ap);
    394390}
     
    409405        buf[0] = ++buflen; /* account for ICB_M_ERROR */
    410406        buf[1] = ICB_M_ERROR;
    411         icb_send(is, buf, buflen + 1);
    412         icb_log(is, LOG_DEBUG, "%s", buf + 2);
     407        icbd_send(is, buf, buflen + 1);
     408        icbd_log(is, LOG_DEBUG, "%s", buf + 2);
    413409}
    414410
     
    620616        va_end(ap);
    621617        buf[0] = buflen;
    622         icb_send(is, buf, buflen + 1);
     618        icbd_send(is, buf, buflen + 1);
    623619}
    624620
Note: See TracChangeset for help on using the changeset viewer.