anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

ns_update.cpp (1503B)

      1 /* NickServ core functions
      2  *
      3  * (C) 2003-2022 Anope Team
      4  * Contact us at team@anope.org
      5  *
      6  * Please read COPYING and README for further details.
      7  *
      8  * Based on the original code of Epona by Lara.
      9  * Based on the original code of Services by Andy Church.
     10  */
     11 
     12 #include "module.h"
     13 
     14 class CommandNSUpdate : public Command
     15 {
     16  public:
     17 	CommandNSUpdate(Module *creator) : Command(creator, "nickserv/update", 0, 0)
     18 	{
     19 		this->SetDesc(_("Updates your current status, i.e. it checks for new memos"));
     20 		this->RequireUser(true);
     21 	}
     22 
     23 	void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
     24 	{
     25 		User *u = source.GetUser();
     26 		NickAlias *na = NickAlias::Find(u->nick);
     27 
     28 		if (na && na->nc == source.GetAccount())
     29 		{
     30 			na->last_realname = u->realname;
     31 			na->last_seen = Anope::CurTime;
     32 		}
     33 
     34 		FOREACH_MOD(OnNickUpdate, (u));
     35 
     36 		source.Reply(_("Status updated (memos, vhost, chmodes, flags)."));
     37 	}
     38 
     39 	bool OnHelp(CommandSource &source, const Anope::string &) anope_override
     40 	{
     41 		this->SendSyntax(source);
     42 		source.Reply(" ");
     43 		source.Reply(_("Updates your current status, i.e. it checks for new memos,\n"
     44 				"sets needed channel modes and updates your vhost and\n"
     45 				"your userflags (lastseentime, etc)."));
     46 		return true;
     47 	}
     48 };
     49 
     50 class NSUpdate : public Module
     51 {
     52 	CommandNSUpdate commandnsupdate;
     53 
     54  public:
     55 	NSUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
     56 		commandnsupdate(this)
     57 	{
     58 
     59 	}
     60 };
     61 
     62 MODULE_INIT(NSUpdate)