summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-06-27 02:41:48 -0400
committerAdam <Adam@anope.org>2010-06-27 02:41:48 -0400
commit57caa0b53f53927c72811ffffda8bb527975860f (patch)
tree7fef9b12d2d86758acb9198001f88f072e8a31d6 /include
parentd49aee6cf88c79220eb785245257544c8051247f (diff)
Made Anope track its own clients internally as if they were real users
Diffstat (limited to 'include')
-rw-r--r--include/bots.h15
-rw-r--r--include/extern.h3
-rw-r--r--include/services.h5
-rw-r--r--include/users.h2
4 files changed, 11 insertions, 14 deletions
diff --git a/include/bots.h b/include/bots.h
index 1b017b058..c1fd14450 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -29,19 +29,12 @@ enum BotFlag
BI_END
};
-class CoreExport BotInfo : public Extensible, public Flags<BotFlag, BI_END>
+class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
{
public:
- std::string uid; /* required for UID supporting servers, as opposed to the shitty struct Uid. */
- std::string nick; /* Nickname of the bot */
- std::string user; /* Its user name */
- std::string host; /* Its hostname */
- std::string real; /* Its real name */
time_t created; /* Birth date ;) */
- int16 chancount; /* Number of channels that use the bot. */
- /* Dynamic data */
time_t lastmsg; /* Last time we said something */
- CommandMap Commands;
+ CommandMap Commands; /* Commands on this bot */
/** Create a new bot.
* @param nick The nickname to assign to the bot.
@@ -76,6 +69,10 @@ class CoreExport BotInfo : public Extensible, public Flags<BotFlag, BI_END>
* @param ci The channel registration to remove the bot from.
*/
void UnAssign(User *u, ChannelInfo *ci);
+
+ void Join(Channel *c);
+ void Join(const std::string &chname);
+ void Part(Channel *c, const std::string &reason = "");
};
#endif // BOTS_H
diff --git a/include/extern.h b/include/extern.h
index 9e6c94de7..ce73cad17 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -53,7 +53,6 @@ E BotInfo *findbot(const ci::string &nick);
* @param uid The UID to search for
* @return The pseudoclient structure, or NULL if one could not be found
*/
-E void bot_join(ChannelInfo *ci);
E char *normalizeBuffer(const char *);
E void bot_raw_ban(User * requester, ChannelInfo *ci, char *nick, const char *reason);
@@ -100,7 +99,7 @@ E Entry *elist_match_user(EList *list, User *u);
E Entry *elist_find_mask(EList *list, const char *mask);
E long get_memuse(EList *list);
-#define whosends(ci) ((!(ci) || !((ci)->botflags.HasFlag(BS_SYMBIOSIS)) || !(ci)->bi || !(ci)->c || (ci)->c->users.size() < Config.BSMinUsers) ? findbot(Config.s_ChanServ) : (ci)->bi)
+#define whosends(ci) (!(ci) || !((ci)->botflags.HasFlag(BS_SYMBIOSIS)) || !(ci)->bi || !(ci)->c || (ci)->c->FindUser((ci)->bi) ? findbot(Config.s_ChanServ) : (ci)->bi)
/**** chanserv.c ****/
diff --git a/include/services.h b/include/services.h
index 766137ba2..b234e438a 100644
--- a/include/services.h
+++ b/include/services.h
@@ -370,8 +370,8 @@ inline const std::string stringify(const T &x)
/*************************************************************************/
-/* forward declarations, mostly used by older code */
class User;
+class BotInfo;
class ChannelInfo;
class Channel;
class Server;
@@ -380,7 +380,6 @@ struct Session;
#include "extensible.h"
#include "threadengine.h"
-#include "bots.h"
#include "opertype.h"
#include "modes.h"
@@ -701,6 +700,8 @@ struct LevelInfo
/*************************************************************************/
#include "users.h"
+#include "bots.h"
+
/* This structure stocks ban data since it must not be removed when
* user is kicked.
*/
diff --git a/include/users.h b/include/users.h
index a6e75680b..870f4f230 100644
--- a/include/users.h
+++ b/include/users.h
@@ -76,7 +76,7 @@ class CoreExport User : public Extensible
/** Destroy a user.
*/
- ~User();
+ virtual ~User();
/** Update the nickname of a user record accordingly, should be
* called from ircd protocol.