/* ircd allows forwards to existing channels; the target channel must be * +F or the setter must have ops in it */ static bool check_forward(const char *value, channel_t *c, mychan_t *mc, user_t *u, myuser_t *mu) { channel_t *target_c; mychan_t *target_mc; chanuser_t *target_cu; if (*value != '#' || strlen(value) > 50) return false; if (u == NULL && mu == NULL) return true; target_c = channel_find(value); target_mc = MYCHAN_FROM(target_c); if (target_c == NULL && target_mc == NULL) return false; if (target_c != NULL && target_c->modes & CMODE_FTARGET) return true; if (target_mc != NULL && target_mc->mlock_on & CMODE_FTARGET) return true; if (u != NULL) { target_cu = chanuser_find(target_c, u); if (target_cu != NULL && target_cu->modes & CSTATUS_OP) return true; if (chanacs_user_flags(target_mc, u) & CA_SET) return true; } else if (mu != NULL) if (chanacs_entity_has_flag(target_mc, entity(mu), CA_SET)) return true; return false; }
static void on_channel_message(hook_cmessage_data_t *data) { if (data != NULL && data->msg != NULL && !strncmp(data->msg, "...", 3)) { mychan_t *mc = MYCHAN_FROM(data->c); if (metadata_find(mc, "kickdots")) { kick(chansvs.me->me, data->c, data->u, data->msg); } } }
static bool check_forward(const char *value, channel_t *c, mychan_t *mc, user_t *u, myuser_t *mu) { channel_t *target_c; mychan_t *target_mc; if (*value != '#' || strlen(value) > 50) return false; if (u == NULL && mu == NULL) return true; target_c = channel_find(value); target_mc = MYCHAN_FROM(target_c); if (target_c == NULL && target_mc == NULL) return false; return true; }
static void on_channel_message(void *p) { hook_cmessage_data_t *data = p; if (data != NULL && data->msg != NULL) { mychan_t *mc = MYCHAN_FROM(data->c); metadata_t *md; if (!mc) return; if (!metadata_find(mc, "babbler:enable")) return; if (!(md = metadata_find(mc, "babbler:nicks"))) return; if (strstr(md->value, data->u->nick)) { char *source = NULL; char *target; if (!(md = metadata_find(mc, "babbler:target"))) return; target = md->value; if (!(md = metadata_find(mc, "babbler:source"))) source = chansvs.nick; else source = md->value; msg(source, data->c->name, "%s: <%s> %s", target, data->u->nick, data->msg); } } }