/* * CHANINFO is used by servers to inform each other about a channel: its * modes, channel key, user limits and its topic. The parameter combination * <key> and <limit> is optional, as well as the <topic> parameter, so that * there are three possible forms of this command: * * CHANINFO <chan> +<modes> * CHANINFO <chan> +<modes> :<topic> * CHANINFO <chan> +<modes> <key> <limit> :<topic> * * The parameter <key> must be ignored if a channel has no key (the parameter * <modes> doesn't list the "k" channel mode). In this case <key> should * contain "*" because the parameter <key> is required by the CHANINFO syntax * and therefore can't be omitted. The parameter <limit> must be ignored when * a channel has no user limit (the parameter <modes> doesn't list the "l" * channel mode). In this case <limit> should be "0". */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { bool created; Channel *c = Channel::FindOrCreate(params[0], created); Anope::string modes = params[1]; if (params.size() == 3) { c->ChangeTopicInternal(NULL, source.GetName(), params[2], Anope::CurTime); } else if (params.size() == 5) { for (size_t i = 0, end = params[1].length(); i < end; ++i) { switch(params[1][i]) { case 'k': modes += " " + params[2]; continue; case 'l': modes += " " + params[3]; continue; } } c->ChangeTopicInternal(NULL, source.GetName(), params[4], Anope::CurTime); } c->SetModesInternal(source, modes); }
void Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { Channel *c = Channel::Find(params[0]); if (c) c->ChangeTopicInternal(source.GetUser(), source.GetSource(), params[1], Anope::CurTime); return; }
// Received: :DukeP TOPIC #anope :test void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { Channel *c = Channel::Find(params[0]); if (!c) { Log(LOG_DEBUG) << "TOPIC for non-existent channel " << params[0]; return; } c->ChangeTopicInternal(source.GetUser(), source.GetName(), params[1], Anope::CurTime); }
void hybrid::TBurst::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { Anope::string setter; sepstream(params[3], '!').GetToken(setter, 0); time_t topic_time = Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime; Channel *c = Channel::Find(params[1]); if (c) c->ChangeTopicInternal(NULL, setter, params[4], topic_time); }
/* * params[0] = channel * params[1] = ts * params[2] = topic OR who set the topic * params[3] = topic if params[2] isn't the topic */ void ratbox::TB::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { time_t topic_time = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; Channel *c = Channel::Find(params[0]); if (!c) return; const Anope::string &setter = params.size() == 4 ? params[2] : "", topic = params.size() == 4 ? params[3] : params[2]; c->ChangeTopicInternal(NULL, setter, topic, topic_time); }
void bahamut::Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { Channel *c = Channel::Find(params[0]); time_t ts = Anope::CurTime; try { ts = convertTo<time_t>(params[2]); } catch (const ConvertException &) { } if (c) c->ChangeTopicInternal(source.GetUser(), params[1], params[3], ts); }
bool OnTopic(const Anope::string &, const std::vector<Anope::string> ¶ms) { if (params.size() < 4) return true; Channel *c = findchan(params[0]); if (!c) { Log() << "TOPIC for nonexistant channel " << params[0]; return true; } c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime); return true; }