Anope IRC Services  Version 2.0
ns_update.cpp
Go to the documentation of this file.
1 /* NickServ core functions
2  *
3  * (C) 2003-2014 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;
32  }
33 
34  FOREACH_MOD(OnNickUpdate, (u));
35 
36  source.Reply(_("Status updated (memos, vhost, chmodes, flags)."));
37  }
38 
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 {
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 
Serialize::Reference< NickCore > nc
Definition: account.h:47
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
Definition: users.h:34
void SetDesc(const Anope::string &d)
Definition: command.cpp:130
CoreExport time_t CurTime
Definition: main.cpp:41
#define FOREACH_MOD(ename, args)
Definition: modules.h:62
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_update.cpp:39
void Reply(const char *message,...)
Definition: command.cpp:96
CommandNSUpdate commandnsupdate
Definition: ns_update.cpp:52
NSUpdate(const Anope::string &modname, const Anope::string &creator)
Definition: ns_update.cpp:55
#define anope_override
Definition: services.h:56
#define MODULE_INIT(x)
Definition: modules.h:45
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_update.cpp:23
Anope::string realname
Definition: users.h:71
bool RequireUser() const
Definition: command.cpp:169
Anope::string nick
Definition: users.h:62
CommandNSUpdate(Module *creator)
Definition: ns_update.cpp:17
time_t last_seen
Definition: account.h:45
void SendSyntax(CommandSource &)
Definition: command.cpp:145
Anope::string last_realname
Definition: account.h:39
#define _(x)
Definition: services.h:50