Exemplo n.º 1
0
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, ",");
	}
}
Exemplo n.º 2
0
/* 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);
}
Exemplo n.º 3
0
/* 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);
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
/* 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);
}
Exemplo n.º 6
0
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);
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
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);
}
Exemplo n.º 9
0
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);
}
Exemplo n.º 10
0
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;
}
Exemplo n.º 11
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);
}
Exemplo n.º 12
0
/* 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;
}
Exemplo n.º 13
0
/**
 * 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;
}
Exemplo n.º 14
0
//==========================================================================================================
//==========================================================================================================
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?
}
Exemplo n.º 15
0
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;
}
Exemplo n.º 16
0
/* 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);
}
Exemplo n.º 17
0
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);
}
Exemplo n.º 18
0
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);
}
Exemplo n.º 19
0
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);
}
Exemplo n.º 20
0
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);
}
Exemplo n.º 21
0
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;
}
Exemplo n.º 22
0
/* 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);
}
Exemplo n.º 23
0
/* 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);
}
Exemplo n.º 24
0
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."));
}
Exemplo n.º 25
0
	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;
	}
Exemplo n.º 26
0
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]);
	}
}
Exemplo n.º 27
0
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;
}
Exemplo n.º 28
0
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);
}
Exemplo n.º 29
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;
}
Exemplo n.º 30
0
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);
	}
}