static void track_oper(struct userNode *user, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if (user->uplink->burst && !track_cfg.show_bursts) return; UPDATE_TIMESTAMP(); TRACK("$bOPER$b %s!%s@%s [%s] on %s", user->nick, user->ident, user->hostname, irc_ntoa(&user->ip), user->uplink->name); }
static void snoop_part(struct modeNode *mn, const char *reason, UNUSED_ARG(void *extra)) { if (!snoop_cfg.enabled) return; if (mn->user->dead) return; UPDATE_TIMESTAMP(); SNOOP("$bPART$b %s by %s (%s)", mn->channel->name, mn->user->nick, reason ? reason : ""); }
void ComponentWAV::Evaluate(int timestamp) { UPDATE_TIMESTAMP(); float v = m_wav.GetSample(m_index); m_index = (m_index + 1) % m_wav.GetSampleCount(); SetOutput(0, v); }
void ComponentIf::Evaluate(int timestamp) { UPDATE_TIMESTAMP(); if (m_inputs[1].comp == NULL || m_inputs[2].comp == NULL) { assignDefaultValue(m_outputs[0].value, m_outputs[0].type); return; } bool cond = true; GetInput(0, &cond); if (cond) { if (PASS_TIMESTAMP(m_inputs[1])) m_inputs[1].comp->Evaluate(timestamp); assignValue(m_outputs[0].value, m_inputs[1].value, m_outputs[0].type); } else { if (PASS_TIMESTAMP(m_inputs[2])) m_inputs[2].comp->Evaluate(timestamp); assignValue(m_outputs[0].value, m_inputs[2].value, m_outputs[0].type); } }
void ComponentTimer::Evaluate(int timestamp) { UPDATE_TIMESTAMP(); while (m_range > 0.0 && m_timer.getElapsedTimeInSec() > m_range) m_timer.modifyElapsedTime(-m_range * 1000 * 1000); SetOutput(0, m_timer.getElapsedTimeInSec()); }
static void snoop_user_mode(struct userNode *user, const char *mode_change, UNUSED_ARG(void *extra)) { if (!snoop_cfg.enabled) return; if (user->uplink->burst && !snoop_cfg.show_bursts) return; if (!mode_change[1]) return; /* warning there has to be atleast one char in the buffer */ UPDATE_TIMESTAMP(); SNOOP("$bUMODE$b %s %s", user->nick, mode_change); }
static int snoop_new_user(struct userNode *user, UNUSED_ARG(void *extra)) { if (!snoop_cfg.enabled) return 0; if (user->uplink->burst && !snoop_cfg.show_bursts) return 0; UPDATE_TIMESTAMP(); SNOOP("$bNICK$b %s %s@%s (%s) [%s] on %s", user->nick, user->ident, user->hostname, user->handle_info?user->handle_info->handle:"", irc_ntoa(&user->ip), user->uplink->name); return 0; }
static void track_part(struct modeNode *mn, const char *reason, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if (mn->user->dead) return; if (check_track_part(track_cfg) && check_track_user(mn->user->nick)) { UPDATE_TIMESTAMP(); TRACK("$bPART$b %s by %s (%s)", mn->channel->name, mn->user->nick, reason ? reason : ""); } }
static void track_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle), UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if (user->uplink->burst && !track_cfg.show_bursts) return; if (user->handle_info && (check_track_auth(track_cfg) && check_track_user(user->nick))) { UPDATE_TIMESTAMP(); TRACK("$bAUTH$b %s!%s@%s [%s] on %s as %s", user->nick, user->ident, user->hostname, irc_ntoa(&user->ip), user->uplink->name, user->handle_info->handle); } }
static void snoop_del_user(struct userNode *user, struct userNode *killer, const char *why, UNUSED_ARG(void *extra)) { if (!snoop_cfg.enabled) return; UPDATE_TIMESTAMP(); if (killer) { SNOOP("$bKILL$b %s (%s@%s, on %s) by %s (%s)", user->nick, user->ident, user->hostname, user->uplink->name, killer->nick, why); } else { SNOOP("$bQUIT$b %s (%s@%s, on %s) (%s)", user->nick, user->ident, user->hostname, user->uplink->name, why); } }
void ComponentOp2::Evaluate(int timestamp) { UPDATE_TIMESTAMP(); if (m_inputs[0].comp == NULL || m_inputs[1].comp == NULL) { assignDefaultValue(m_outputs[0].value, m_outputs[0].type); return; } // There are certainly better ways to do this, but I'm not using them yet double v0d, v1d; bool v0b, v1b; void *v0, *v1; if (m_inputs[0].type == CT_DOUBLE) v0 = &v0d; else if (m_inputs[0].type == CT_BOOL) v0 = &v0b; if (m_inputs[1].type == CT_DOUBLE) v1 = &v1d; else if (m_inputs[1].type == CT_BOOL) v1 = &v1b; if (PASS_TIMESTAMP(m_inputs[0])) m_inputs[0].comp->Evaluate(timestamp); if (PASS_TIMESTAMP(m_inputs[1])) m_inputs[1].comp->Evaluate(timestamp); assignValue(v0, m_inputs[0].value, m_inputs[0].type); assignValue(v1, m_inputs[1].value, m_inputs[1].type); if (m_operator == '+') *(double *)m_outputs[0].value = *(double *)v0 + *(double *)v1; else if (m_operator == '-') *(double *)m_outputs[0].value = *(double *)v0 - *(double *)v1; else if (m_operator == '*') *(double *)m_outputs[0].value = *(double *)v0 * *(double *)v1; else if (m_operator == '/') *(double *)m_outputs[0].value = *(double *)v0 / *(double *)v1; else if (m_operator == '<') *(bool *)m_outputs[0].value = *(double *)v0 < *(double *)v1; else if (m_operator == '>') *(bool *)m_outputs[0].value = *(double *)v0 > *(double *)v1; else if (m_operator == '|') *(bool *)m_outputs[0].value = *(bool *)v0 || *(bool *)v1; else if (m_operator == '&') *(bool *)m_outputs[0].value = *(bool *)v0 && *(bool *)v1; else if (m_operator == '=') { if (m_inputs[0].type == CT_DOUBLE) *(bool *)m_outputs[0].value = *(double *)v0 == *(double *)v1; else if (m_inputs[0].type == CT_BOOL) *(bool *)m_outputs[0].value = *(bool *)v0 == *(bool *)v1; } }
static void track_user_mode(struct userNode *user, const char *mode_change, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if (user->uplink->burst && !track_cfg.show_bursts) return; if (!mode_change[1]) return; /* warning there has to be atleast one char in the buffer */ if(check_track_umode(track_cfg) && check_track_user(user->nick)) { UPDATE_TIMESTAMP(); TRACK("$bUMODE$b %s %s", user->nick, mode_change); } }
static void snoop_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle), UNUSED_ARG(void *extra)) { if (!snoop_cfg.enabled) return; if (user->uplink->burst && !snoop_cfg.show_bursts) return; if (user->handle_info) { UPDATE_TIMESTAMP(); /* TODO: show old_handle info -> new handle info if they * re-authed or something. */ SNOOP("$bAUTH$b %s as %s", user->nick, user->handle_info->handle); } }
static int track_new_user(struct userNode *user, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return 0; if (user->uplink->burst && !track_cfg.show_bursts) return 0; if (check_track_new(track_cfg) && check_track_user(user->nick)) { UPDATE_TIMESTAMP(); TRACK("$bNICK$b %s %s@%s [%s] on %s", user->nick, user->ident, user->hostname, irc_ntoa(&user->ip), user->uplink->name); } return 0; }
static int snoop_join(struct modeNode *mNode, UNUSED_ARG(void *extra)) { struct userNode *user = mNode->user; struct chanNode *chan = mNode->channel; if (!snoop_cfg.enabled) return 0; if (user->uplink->burst && !snoop_cfg.show_bursts) return 0; UPDATE_TIMESTAMP(); if (chan->members.used == 1) { SNOOP("$bCREATE$b %s by %s", chan->name, user->nick); } else { SNOOP("$bJOIN$b %s by %s", chan->name, user->nick); } return 0; }
static void track_del_user(struct userNode *user, struct userNode *killer, const char *why, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if (check_track_del(track_cfg) && (check_track_user(user->nick) || (killer && check_track_user(killer->nick)))) { UPDATE_TIMESTAMP(); if (killer) { TRACK("$bKILL$b %s (%s@%s, on %s) by %s (%s)", user->nick, user->ident, user->hostname, user->uplink->name, killer->nick, why); } else { TRACK("$bQUIT$b %s (%s@%s, on %s) (%s)", user->nick, user->ident, user->hostname, user->uplink->name, why); } del_track_user(user->nick); } }
static void track_nick_change(struct userNode *user, const char *old_nick, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if(check_track_user(old_nick)) { del_track_user(old_nick); add_track_user(user); if (check_track_nick(track_cfg)) { UPDATE_TIMESTAMP(); TRACK("$bNICK$b change %s -> %s", old_nick, user->nick); } } }
static void track_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *chan, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if (check_track_kick(track_cfg) && check_track_user(victim->nick)) { if (kicker) /* net rider kicks dont have a kicker set */ { if (!check_track_user(kicker->nick)) return; } UPDATE_TIMESTAMP(); TRACK("$bKICK$b %s from %s by %s", victim->nick, chan->name, (kicker ? kicker->nick : "some server")); } }
static int track_join(struct modeNode *mNode, UNUSED_ARG(void *extra)) { struct userNode *user = mNode->user; struct chanNode *chan = mNode->channel; if (!track_cfg.enabled) return 0; if (user->uplink->burst && !track_cfg.show_bursts) return 0; if (check_track_join(track_cfg) && check_track_user(user->nick)) { UPDATE_TIMESTAMP(); if (chan->members.used == 1) { TRACK("$bCREATE$b %s by %s", chan->name, user->nick); } else { TRACK("$bJOIN$b %s by %s", chan->name, user->nick); } } return 0; }
static void snoop_nick_change(struct userNode *user, const char *old_nick, UNUSED_ARG(void *extra)) { if (!snoop_cfg.enabled) return; UPDATE_TIMESTAMP(); SNOOP("$bNICK$b change %s -> %s", old_nick, user->nick); }
static void track_channel_mode(struct userNode *who, struct chanNode *channel, char **modes, unsigned int argc, UNUSED_ARG(void *extra)) { if (!track_cfg.enabled) return; if(who) { if (who->uplink->burst && !track_cfg.show_bursts) return; if (!check_track_chanmode(track_cfg) || !check_track_user(who->nick)) return; } else return; static char targets[MAXLEN], string[MAXLEN]; struct userNode *un = NULL; char *tmp = NULL, *tg = NULL, *md = NULL; int add = 0; string[0] = 0; targets[0] = 0; if (argc > 0) unsplit_string(modes, argc, string); else strcpy(string, *modes); if((tg = strchr(string, ' '))) { *tg++ = 0; for(md = string; *md; md++) { if (*md == '+') { add = 1; md++; } if (*md == '-') { add = 0; md++; } switch(*md) { case 'k': { strcat(targets, " "); if ((tmp = strchr(tg, ' '))) *tmp++ = 0; strcat(targets, tg); if(tmp) tg = tmp; break; } case 'l': { if(add) { strcat(targets, " "); if ((tmp = strchr(tg, ' '))) *tmp++ = 0; strcat(targets, tg); if(tmp) tg = tmp; break; } } case 'b': { strcat(targets, " "); if ((tmp = strchr(tg, ' '))) *tmp++ = 0; strcat(targets, tg); if(tmp) tg = tmp; break; } case 'e': { strcat(targets, " "); if ((tmp = strchr(tg, ' '))) *tmp++ = 0; strcat(targets, tg); if(tmp) tg = tmp; break; } case 'o': { strcat(targets, " "); if ((tmp = strchr(tg, ' '))) *tmp++ = 0; if((un = GetUserN(tg))) strcat(targets, un->nick); else strcat(targets, tg); if(tmp) tg = tmp; break; } case 'v': { strcat(targets, " "); if ((tmp = strchr(tg, ' '))) *tmp++ = 0; if((un = GetUserN(tg))) strcat(targets, un->nick); else strcat(targets, tg); if(tmp) tg = tmp; break; } } } } UPDATE_TIMESTAMP(); if (who) TRACK("$bMODE$b %s %s%s by %s", channel->name, string, targets, who->nick); else TRACK("$bMODE$b %s %s%s", channel->name, string, targets); }
static void snoop_kick(struct userNode *kicker, struct userNode *victim, struct chanNode *chan, UNUSED_ARG(void *extra)) { if (!snoop_cfg.enabled) return; UPDATE_TIMESTAMP(); SNOOP("$bKICK$b %s from %s by %s", victim->nick, chan->name, (kicker ? kicker->nick : "some server")); }