static void ajoin_on_identify(user_t *u) { myuser_t *mu = u->myuser; metadata_t *md; char buf[512]; char *chan; if (!(md = metadata_find(mu, "private:autojoin"))) return; mowgli_strlcpy(buf, md->value, sizeof buf); chan = strtok(buf, " ,"); while (chan != NULL) { if(ircd->type == PROTOCOL_SHADOWIRCD) { sts(":%s ENCAP * SVSJOIN %s %s", ME, CLIENT_NAME(u), chan); } else { sts(":%s SVSJOIN %s %s", CLIENT_NAME(nicksvs.me->me), CLIENT_NAME(u), chan); } chan = strtok(NULL, ","); } }
/* NOTICE wrapper */ static void asuka_notice_channel_sts(user_t *from, channel_t *target, const char *text) { if (from == NULL || chanuser_find(target, from)) sts("%s O %s :%s", from ? from->uid : me.numeric, target->name, text); else sts("%s O %s :[%s:%s] %s", me.numeric, target->name, from->nick, target->name, text); }
/* introduce a client */ static void ithildin_introduce_nick(user_t *u) { const char *umode = user_get_umodestr(u); sts("NICK %s 1 %lu %s %s %s :%s", u->nick, (unsigned long)u->ts, u->user, u->host, me.name, u->gecos); sts(":%s MODE %s %s", u->nick, u->nick, umode); }
static bool chatd_on_logout(user_t *u, const char *account) { return_val_if_fail(u != NULL, false); sts(":%s ENCAP * SU %s", ME, CLIENT_NAME(u)); sts(":%s ENCAP * IDENTIFIED %s %s OFF", ME, CLIENT_NAME(u), u->nick); return false; }
/* protocol-specific stuff to do on login */ static void chatd_on_login(user_t *u, myuser_t *mu, const char *wantedhost) { return_if_fail(u != NULL); sts(":%s ENCAP * SU %s %s", ME, CLIENT_NAME(u), entity(mu)->name); if (should_reg_umode(u)) sts(":%s ENCAP * IDENTIFIED %s %s", ME, CLIENT_NAME(u), u->nick); }
static void plexus_introduce_nick(user_t *u) { const char *umode = user_get_umodestr(u); if (ircd->uses_uid) sts(":%s UID %s 1 %lu %s %s %s 127.0.0.1 %s 0 %s :%s", me.numeric, u->nick, (unsigned long)u->ts, umode, u->user, u->host, u->uid, u->host, u->gecos); else sts("NICK %s 1 %lu %s %s %s %s :%s", u->nick, (unsigned long)u->ts, umode, u->user, u->host, me.name, u->gecos); }
static void plexus_introduce_nick(user_t *u) { const char *omode = is_ircop(u) ? "o" : ""; if (ircd->uses_uid) sts(":%s UID %s 1 %lu +i%s%s %s %s 127.0.0.1 %s 0 %s :%s", me.numeric, u->nick, (unsigned long)u->ts, omode, chansvs.fantasy ? "" : "D", u->user, u->host, u->uid, u->host, u->gecos); else sts("NICK %s 1 %lu +i%s%s %s %s %s :%s", u->nick, (unsigned long)u->ts, omode, chansvs.fantasy ? "" : "D", u->user, u->host, me.name, u->gecos); }
static void asuka_wallchops(user_t *sender, channel_t *channel, const char *message) { if (channel->modes & CMODE_NONOTICE) { /* asuka sucks */ /* remove that stupid +N mode before it blocks our notice * -- jilles */ sts("%s M %s -N", sender->uid, channel->name); channel->modes &= ~CMODE_NONOTICE; } sts("%s WC %s :%s", sender->uid, channel->name, message); }
static void plexus_sethost_sts(user_t *source, user_t *target, const char *host) { if (!me.connected) return; if (irccasecmp(target->host, host)) numeric_sts(me.me, 396, target, "%s :is now your hidden host (set by %s)", host, source->nick); else { numeric_sts(me.me, 396, target, "%s :hostname reset by %s", host, source->nick); sts(":%s ENCAP * SVSMODE %s %lu -x", CLIENT_NAME(source), CLIENT_NAME(target), (unsigned long)target->ts); } sts(":%s ENCAP * CHGHOST %s :%s", ME, CLIENT_NAME(target), host); }
static unsigned int ith_server_login(void) { int ret; ret = sts("PASS %s :TS", curr_uplink->pass); if (ret == 1) { return 1; } me.bursting = true; sts("SERVER %s 1 :%s", me.name, me.desc); sts("SVINFO 5 3 0 :%lu", (unsigned long)CURRTIME); services_init(); return 0; }
/* NOTICE wrapper */ static void asuka_notice_channel_sts(user_t *from, channel_t *target, const char *text) { if (target->modes & CMODE_NONOTICE) { /* asuka sucks */ /* remove that stupid +N mode before it blocks our notice * -- jilles */ sts("%s M %s -N", from ? from->uid : me.numeric, target->name); target->modes &= ~CMODE_NONOTICE; } if (from == NULL || chanuser_find(target, from)) sts("%s O %s :%s", from ? from->uid : me.numeric, target->name, text); else sts("%s O %s :[%s:%s] %s", me.numeric, target->name, from->nick, target->name, text); }
/* protocol-specific stuff to do on login */ static bool plexus_on_logout(user_t *u, const char *account) { if (!me.connected || u == NULL) return false; if (nicksvs.no_nick_ownership) return false; #ifdef USE_NETADMIN sts(":%s ENCAP * SVSMODE %s %lu -rN", nicksvs.nick, u->nick, (unsigned long)u->ts); #else sts(":%s ENCAP * SVSMODE %s %lu -r", nicksvs.nick, u->nick, (unsigned long)u->ts); #endif return false; }
/** * get MSSQL ODBC drivers name and version, every item such as: * ------------------------------------------------------------- * 10.00/SQL Server Native Client 10.0 * 09.00/SQL Native Client * 03.50/SQL Server * ------------------------------------------------------------- * @author XChinux<*****@*****.**> * @final 2013-04-18 * @return QStringList desc sorted ver/drivername lists */ QStringList TcMSSQL::availableODBCDrivers() { QStringList slDrivers; #ifdef Q_OS_WIN QSettings sts("HKEY_LOCAL_MACHINE\\SOFTWARE\\ODBC\\ODBCINST.INI" "\\ODBC Drivers", QSettings::NativeFormat); QStringList slKeys = sts.allKeys(); QStringList slKeys2; slKeys2 << slKeys.filter("SQL Server") << slKeys.filter("Native Client"); slKeys2.removeDuplicates(); QStringListIterator it(slKeys2); while (it.hasNext()) { QString strV = it.next(); if (sts.value(strV).toString() == "Installed") { QSettings sts2("HKEY_LOCAL_MACHINE\\SOFTWARE\\ODBC\\ODBCINST.INI\\" + strV, QSettings::NativeFormat); strV.prepend(sts2.value("DriverODBCVer").toString() + "/"); slDrivers << strV; } } qSort(slDrivers.begin(), slDrivers.end(), qGreater<QString>()); #endif return slDrivers; }
//========================================================================================================== //========================================================================================================== void Grammar::extract_symbols(string production_str, vector<Symbol>& symbols) { trim(production_str); // Must trim! o/w stringstream gets confused! regex production_re("(\\w+)\\s*->\\s*(.*)"); // Note: the RHS needs to parsed word by word smatch match_res; if(not regex_match(production_str, match_res, production_re)) throw string("Unknown production in line:\n" + production_str); Symbol N = symbol_str_map[match_res[1]]; if(not is_nonterminal(N)) throw string("Expected left hand side of a production to be a nonterminal but received:\n" + production_str); symbols.push_back(N); stringstream sts(match_res[2]); string symbol_str; while(!sts.eof()) { // Extract the symbol names sts >> symbol_str; symbols.push_back(symbol_str_map[symbol_str]); } if(symbols.size() < 2) throw string("Production must have at least two symbols"); // TODO: what about production of the empty string? }
static void ping_uplink(void *arg) { unsigned int diff; if (me.connected) { ping_sts(); diff = CURRTIME - me.uplinkpong; if (diff >= 600) { slog(LG_INFO, "ping_uplink(): uplink appears to be dead, disconnecting"); sts("ERROR :Closing Link: 127.0.0.1 (Ping timeout: %d seconds)", diff); sendq_flush(curr_uplink->conn); if (me.connected) { errno = 0; connection_close(curr_uplink->conn); } } } if (!me.connected) ping_uplink_timer = NULL; }
/* protocol-specific stuff to do on login */ static void asuka_on_login(user_t *u, myuser_t *account, const char *wantedhost) { return_if_fail(u != NULL); sts("%s AC %s %s %lu", me.numeric, u->uid, entity(u->myuser)->name, (unsigned long)account->registered); check_hidehost(u); }
static void nick_group(hook_user_req_t *hdata) { user_t *u; u = hdata->si->su != NULL && !irccasecmp(hdata->si->su->nick, hdata->mn->nick) ? hdata->si->su : user_find_named(hdata->mn->nick); if (u != NULL && should_reg_umode(u)) sts(":%s ENCAP * SVSMODE %s %lu +rd %lu", nicksvs.nick, u->nick, (unsigned long)u->ts, (unsigned long)CURRTIME); }
static void nick_ungroup(hook_user_req_t *hdata) { user_t *u; u = hdata->si->su != NULL && !irccasecmp(hdata->si->su->nick, hdata->mn->nick) ? hdata->si->su : user_find_named(hdata->mn->nick); if (u != NULL && !nicksvs.no_nick_ownership) sts(":%s ENCAP * SVSMODE %s %lu -r", nicksvs.nick, u->nick, (unsigned long)u->ts); }
static void nick_ungroup(hook_user_req_t *hdata) { user_t *u; u = hdata->si->su != NULL && !irccasecmp(hdata->si->su->nick, hdata->mn->nick) ? hdata->si->su : user_find_named(hdata->mn->nick); if (u != NULL && !nicksvs.no_nick_ownership) sts(":%s ENCAP * IDENTIFIED %s %s OFF", ME, CLIENT_NAME(u), u->nick); }
static void nick_group(hook_user_req_t *hdata) { user_t *u; u = hdata->si->su != NULL && !irccasecmp(hdata->si->su->nick, hdata->mn->nick) ? hdata->si->su : user_find_named(hdata->mn->nick); if (u != NULL && should_reg_umode(u)) sts(":%s ENCAP * IDENTIFIED %s %s", ME, CLIENT_NAME(u), u->nick); }
wb_object wb_session::createObject(wb_cdef cdef, wb_destination d, wb_name name) { wb_orep* orep = 0; if (isReadonly()) throw wb_error_str("ReadOnlySession"); validateDestination(d, cdef.cid()); if (evenSts()) throw wb_error(sts()); wb_object parent; switch (d.code()) { case ldh_eDest_IntoFirst: case ldh_eDest_IntoLast: parent = object(d.oid()); break; case ldh_eDest_After: case ldh_eDest_Before: parent = object(d.oid()).parent(); break; default: throw wb_error(LDH__NODEST); } m_sts = triggAnteCreate(parent, cdef.cid()); if (evenSts()) throw wb_error(sts()); m_sts = triggAnteAdopt(parent, cdef.cid()); if (evenSts()) throw wb_error(sts()); orep = m_vrep->createObject(&m_sts, cdef, d, name); if (evenSts()) throw wb_error(sts()); m_srep->update(); wb_object o = wb_object(m_sts, orep); ldh_sEvent* ep = m_srep->eventStart(o.oid(), ldh_eEvent_ObjectCreated); m_srep->eventNewFamily(ep, o); triggPostCreate(o); triggPostAdopt(parent, o); m_srep->eventSend(ep); return o; }
/* protocol-specific stuff to do on login */ static void plexus_on_login(user_t *u, myuser_t *account, const char *wantedhost) { if (!me.connected || u == NULL) return; /* Can only do this for nickserv, and can only record identified * state if logged in to correct nick, sorry -- jilles */ if (!should_reg_umode(u)) return; #ifdef USE_NETADMIN if (has_priv_user(u, PRIV_ADMIN)) sts(":%s ENCAP * SVSMODE %s %lu +rdN %lu", nicksvs.nick, u->nick, (unsigned long)u->ts, (unsigned long)CURRTIME); else #endif sts(":%s ENCAP * SVSMODE %s %lu +rd %lu", nicksvs.nick, u->nick, (unsigned long)u->ts, (unsigned long)CURRTIME); }
/* protocol-specific stuff to do on login */ static void asuka_on_login(user_t *u, myuser_t *account, const char *wantedhost) { if (!me.connected || u == NULL) return; sts("%s AC %s %s %lu", me.numeric, u->uid, account->name, (unsigned long)account->registered); check_hidehost(u); }
static void os_cmd_helpme(sourceinfo_t *si, int parc, char *parv[]) { service_t *svs; svs = service_find("operserv"); sts(":%s MODE %s :+h", svs->nick, si->su->nick); command_success_nodata(si, _("You are now a network helper.")); }
vector<int> deserializeSchedule(int njobs, const string &filename) { vector<int> sts(njobs); auto lines = Utils::readLines(filename); for(auto line : lines) { if(!boost::contains(line, "->")) continue; int j, stj; std::sscanf(line.c_str(), "%d->%d", &j, &stj); sts[j-1] = stj; } return sts; }
static void m_euid(sourceinfo_t *si, int parc, char *parv[]) { server_t *s; user_t *u; /* got the right number of args for an introduction? */ if (parc >= 11) { s = si->s; slog(LG_DEBUG, "m_euid(): new user on `%s': %s", s->name, parv[0]); u = user_add(parv[0], /* nick */ parv[4], /* user */ *parv[8] != '*' ? parv[8] : parv[5], /* hostname */ parv[5], /* hostname (visible) */ parv[6], /* ip */ parv[7], /* uid */ parv[parc - 1], /* gecos */ s, /* object parent (server) */ atoi(parv[2])); /* hopcount */ if (u == NULL) return; user_mode(u, parv[3]); if (*parv[9] != '*') { handle_burstlogin(u, parv[9], 0); /* If an account is given in burst, then either they logged in with sasl, * or they logged in before a split and are now returning. Either way we need * to check for identified-to-nick status and update the ircd state accordingly. * For sasl they should be marked identified, and when returning from a split * their nick may have been ungrouped, they may have changed nicks, or their account * may have been dropped. */ if (authservice_loaded) sts(":%s ENCAP * IDENTIFIED %s %s %s", ME, CLIENT_NAME(u), u->nick, should_reg_umode(u) ? "" : "OFF"); } /* server_eob() cannot know if a user was introduced * with NICK/UID or EUID and handle_nickchange() must * be called exactly once for each new user -- jilles */ if (s->flags & SF_EOB) handle_nickchange(u); } else { int i; slog(LG_DEBUG, "m_euid(): got EUID with wrong number of params"); for (i = 0; i < parc; i++) slog(LG_DEBUG, "m_euid(): parv[%d] = %s", i, parv[i]); } }
vector<int> Project::serialSGSCore(const vector<int>& order, Matrix<int>& resRem, bool robust) const { vector<int> sts(numJobs, UNSCHEDULED), fts(numJobs, UNSCHEDULED); for (int i = 0; i < numJobs; i++) { int job = robust ? chooseEligibleWithLowestIndex(sts, order) : order[i]; int lastPredFinished = computeLastPredFinishingTime(fts, job); int t; for (t = lastPredFinished; !enoughCapacityForJob(job, t, resRem); t++); scheduleJobAt(job, t, sts, fts, resRem); } return sts; }
int main(int argc, char* argv[]){ CanvasManager *cm = new CanvasManager(); AnimationManager *am = new AnimationManager(cm); { SampleTwitterScreen sts(cm); cm->render(); sleep(50); } delete cm; exit(0); }
/* flush stacked and waiting cmodes */ static void flush_cmode(struct modedata_ *md) { char buf[BUFSIZE]; int len = 0; char lastc = 0; if (!md->binmodes_on && !md->binmodes_off && !*md->opmodes) { memset(md, 0, sizeof(*md)); md->last_add = -1; return; } if (md->binmodes_off) { len += snprintf(buf + len, sizeof(buf) - len, "-%s", flags_to_string(md->binmodes_off)); lastc = '-'; } if (md->binmodes_on) { len += snprintf(buf + len, sizeof(buf) - len, "+%s", flags_to_string(md->binmodes_on)); lastc = '+'; } if (*md->opmodes) { if (*md->opmodes == lastc) memmove(md->opmodes, md->opmodes + 1, strlen(md->opmodes + 1) + 1); len += snprintf(buf + len, sizeof(buf) - len, "%s", md->opmodes); } if (md->paramslen) snprintf(buf + len, sizeof(buf) - len, " %s", md->params); sts(":%s MODE %s %s", md->sender, md->channel, buf); memset(md, 0, sizeof(*md)); md->last_add = -1; }
static void hook_user_identify(user_t *u) { int ret; char *ident; char buf[100]; myuser_t *mu = u->myuser; if (mu == NULL) { snprintf(buf, 100, "%s_insecure", entity(mu)->name); ident = buf; } else { ident = entity(mu)->name; } ret = sts("CHGIDENT %s %s", u->uid, ident); if (ret == 1) { slog(LG_INFO, "Could not set ident (%s) for user (%s): ret (%d)", ident, u->uid, ret); } }