diff options
| author | Adam <Adam@anope.org> | 2010-09-15 16:40:55 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-09-15 16:40:55 -0400 |
| commit | 813185105823daa6a1b574d86053950382343589 (patch) | |
| tree | 793d4f54cddc88275b4372839f93bba01301b427 /src/chanserv.cpp | |
| parent | 6239b5a053fc8fd94b798495f8e189a2e2bda285 (diff) | |
Rewrote all of the topic code, fixes a few topic related problems on some older IRCds
Diffstat (limited to 'src/chanserv.cpp')
| -rw-r--r-- | src/chanserv.cpp | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/src/chanserv.cpp b/src/chanserv.cpp index c0ae4efd9..9d8fb411a 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -422,133 +422,6 @@ int check_valid_op(User *user, Channel *chan, int servermode) /*************************************************************************/ -/* Record the current channel topic in the ChannelInfo structure. */ - -void record_topic(const Anope::string &chan) -{ - Channel *c; - ChannelInfo *ci; - - if (readonly) - return; - - c = findchan(chan); - if (!c || !(ci = c->ci)) - return; - - ci->last_topic = c->topic; - ci->last_topic_setter = c->topic_setter; - ci->last_topic_time = c->topic_time; -} - -/*************************************************************************/ - -/* Restore the topic in a channel when it's created, if we should. */ - -void restore_topic(const Anope::string &chan) -{ - Channel *c = findchan(chan); - ChannelInfo *ci; - - if (!c || !(ci = c->ci)) - return; - /* We can be sure that the topic will be in sync when we return -GD */ - c->topic_sync = 1; - if (!ci->HasFlag(CI_KEEPTOPIC)) - { - /* We need to reset the topic here, since it's currently empty and - * should be updated with a TOPIC from the IRCd soon. -GD - */ - ci->last_topic.clear(); - ci->last_topic_setter = whosends(ci)->nick; - ci->last_topic_time = Anope::CurTime; - return; - } - if (!ci->last_topic.empty()) - { - c->topic = ci->last_topic; - c->topic_setter = ci->last_topic_setter; - c->topic_time = ci->last_topic_time; - } - else - { - c->topic.clear(); - c->topic_setter = whosends(ci)->nick; - } - if (ircd->join2set && whosends(ci) == ChanServ) - { - ChanServ->Join(chan); - c->SetMode(NULL, CMODE_OP, Config->s_ChanServ); - } - ircdproto->SendTopic(whosends(ci), c, c->topic_setter, c->topic); - if (ircd->join2set && whosends(ci) == ChanServ) - ChanServ->Part(c); -} - -/*************************************************************************/ - -/* See if the topic is locked on the given channel, and return 1 (and fix - * the topic) if so. */ - -int check_topiclock(Channel *c, time_t topic_time) -{ - ChannelInfo *ci; - - if (!c) - { - Log() << "check_topiclock called with NULL values"; - return 0; - } - - if (!(ci = c->ci) || !ci->HasFlag(CI_TOPICLOCK)) - return 0; - - if (!ci->last_topic.empty()) - { - c->topic = ci->last_topic; - c->topic_setter = ci->last_topic_setter; - } - else - { - c->topic.clear(); - /* Bot assigned & Symbiosis ON?, the bot will set the topic - doc */ - /* Altough whosends() also checks for Config->BSMinUsers -GD */ - c->topic_setter = whosends(ci)->nick; - } - - if (ircd->topictsforward) - { - /* Because older timestamps are rejected */ - /* Some how the topic_time from do_topic is 0 set it to current + 1 */ - if (!topic_time) - c->topic_time = Anope::CurTime + 1; - else - c->topic_time = topic_time + 1; - } - else - { - /* If no last topic, we can't use last topic time! - doc */ - if (!ci->last_topic.empty()) - c->topic_time = ci->last_topic_time; - else - c->topic_time = Anope::CurTime + 1; - } - - if (ircd->join2set && whosends(ci) == ChanServ) - { - ChanServ->Join(c); - c->SetMode(NULL, CMODE_OP, Config->s_ChanServ); - } - - ircdproto->SendTopic(whosends(ci), c, c->topic_setter, c->topic); - - if (ircd->join2set && whosends(ci) == ChanServ) - ChanServ->Part(c); - return 1; -} - -/*************************************************************************/ - /* Remove all channels which have expired. */ void expire_chans() |
