mirror of
https://github.com/anope/anope.git
synced 2026-06-28 00:36:37 +02:00
Fix a few things that bugged me when I was working on one of my own modules.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2573 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -425,6 +425,8 @@ class CoreExport sepstream
|
||||
/** Create a sepstream and fill it with the provided data
|
||||
*/
|
||||
sepstream(const std::string &source, char seperator);
|
||||
sepstream(const ci::string &source, char seperator);
|
||||
sepstream(const char *source, char seperator);
|
||||
virtual ~sepstream() { }
|
||||
|
||||
/** Fetch the next token from the stream
|
||||
@@ -432,6 +434,7 @@ class CoreExport sepstream
|
||||
* @return True if tokens still remain, false if there are none left
|
||||
*/
|
||||
virtual bool GetToken(std::string &token);
|
||||
virtual bool GetToken(ci::string &token);
|
||||
|
||||
/** Fetch the entire remaining stream, without tokenizing
|
||||
* @return The remaining part of the stream
|
||||
@@ -452,6 +455,8 @@ class CoreExport commasepstream : public sepstream
|
||||
/** Initialize with comma seperator
|
||||
*/
|
||||
commasepstream(const std::string &source) : sepstream(source, ',') { }
|
||||
commasepstream(const ci::string &source) : sepstream(source, ',') { }
|
||||
commasepstream(const char *source) : sepstream(source, ',') { }
|
||||
};
|
||||
|
||||
/** A derived form of sepstream, which seperates on spaces
|
||||
@@ -462,6 +467,8 @@ class CoreExport spacesepstream : public sepstream
|
||||
/** Initialize with space seperator
|
||||
*/
|
||||
spacesepstream(const std::string &source) : sepstream(source, ' ') { }
|
||||
spacesepstream(const ci::string &source) : sepstream(source, ' ') { }
|
||||
spacesepstream(const char *source) : sepstream(source, ' ') { }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -471,7 +471,7 @@ class CoreExport Module
|
||||
* @param number The message number
|
||||
* @param ... The argument list
|
||||
**/
|
||||
void NoticeLang(char *source, User * u, int number, ...);
|
||||
void NoticeLang(const char *source, User * u, int number, ...);
|
||||
|
||||
/**
|
||||
* Add a module provided command to the given service.
|
||||
@@ -721,7 +721,7 @@ class CoreExport Module
|
||||
*/
|
||||
virtual void OnServerQuit(Server *server) { }
|
||||
|
||||
/** Called on a QUIT
|
||||
/** Called on a QUIT
|
||||
* @param u The user
|
||||
* @param msg The quit message
|
||||
*/
|
||||
@@ -866,7 +866,7 @@ class CoreExport Module
|
||||
*/
|
||||
virtual void OnDelNick(NickAlias *na) { }
|
||||
|
||||
/* Called on findcore()
|
||||
/** Called on findcore()
|
||||
* @param nick nickname to be searched for (nc->display)
|
||||
*/
|
||||
virtual void OnFindCore(const std::string &nick) { }
|
||||
@@ -908,7 +908,7 @@ class CoreExport Module
|
||||
*/
|
||||
virtual void OnNickEraseAccess(NickCore *nc, const std::string &entry) { }
|
||||
|
||||
/** called when a HostCore is deleted
|
||||
/** called when a HostCore is deleted
|
||||
* @param hc pointer to the HostCore
|
||||
*/
|
||||
virtual void OnDeleteHostCore(HostCore *hc) { }
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
class CoreExport ChannelInfo : public Extensible
|
||||
{
|
||||
private:
|
||||
std::map<ChannelModeName, std::string> Params;
|
||||
std::map<ChannelModeName, std::string> Params;
|
||||
|
||||
public:
|
||||
ChannelInfo()
|
||||
|
||||
+6
-6
@@ -463,7 +463,7 @@ enum ChannelModeName
|
||||
CMODE_NOCTCP, CMODE_FILTER, CMODE_NOKNOCK, CMODE_REDIRECT, CMODE_REGMODERATED, CMODE_NONICK, CMODE_OPERONLY,
|
||||
CMODE_NOKICK, CMODE_REGISTEREDONLY, CMODE_STRIPCOLOR, CMODE_NONOTICE, CMODE_NOINVITE, CMODE_ALLINVITE,
|
||||
CMODE_BLOCKCAPS, CMODE_PERM,
|
||||
|
||||
|
||||
/* b/e/I */
|
||||
CMODE_BAN, CMODE_EXCEPT,
|
||||
CMODE_INVITEOVERRIDE,
|
||||
@@ -882,7 +882,7 @@ struct c_userlist {
|
||||
UserData *ud;
|
||||
};
|
||||
|
||||
class CoreExport Channel
|
||||
class CoreExport Channel : public Extensible
|
||||
{
|
||||
private:
|
||||
/** A map of channel modes with their parameters set on this channel
|
||||
@@ -1253,7 +1253,7 @@ class ChannelModeParam : public ChannelMode
|
||||
class ChannelModeStatus : public ChannelMode
|
||||
{
|
||||
public:
|
||||
/** CUS_ values, see below
|
||||
/** CUS_ values, see below
|
||||
*/
|
||||
int16 Status;
|
||||
/* The symbol, eg @ % + */
|
||||
@@ -1404,7 +1404,7 @@ class ChannelModeAdmin : public ChannelMode
|
||||
{
|
||||
public:
|
||||
ChannelModeAdmin() : ChannelMode(CMODE_ADMINONLY) { }
|
||||
|
||||
|
||||
/* Opers only */
|
||||
bool CanSet(User *u);
|
||||
};
|
||||
@@ -1416,7 +1416,7 @@ class ChannelModeOper : public ChannelMode
|
||||
{
|
||||
public:
|
||||
ChannelModeOper() : ChannelMode(CMODE_OPERONLY) { }
|
||||
|
||||
|
||||
/* Opers only */
|
||||
bool CanSet(User *u);
|
||||
};
|
||||
@@ -1428,7 +1428,7 @@ class ChannelModeRegistered : public ChannelMode
|
||||
{
|
||||
public:
|
||||
ChannelModeRegistered() : ChannelMode(CMODE_REGISTERED) { }
|
||||
|
||||
|
||||
/* No one mlocks +r */
|
||||
bool CanSet(User *u);
|
||||
};
|
||||
|
||||
@@ -112,6 +112,16 @@ sepstream::sepstream(const std::string &source, char seperator) : tokens(source)
|
||||
last_starting_position = n = tokens.begin();
|
||||
}
|
||||
|
||||
sepstream::sepstream(const ci::string &source, char seperator) : tokens(source.c_str()), sep(seperator)
|
||||
{
|
||||
last_starting_position = n = tokens.begin();
|
||||
}
|
||||
|
||||
sepstream::sepstream(const char *source, char seperator) : tokens(source), sep(seperator)
|
||||
{
|
||||
last_starting_position = n = tokens.begin();
|
||||
}
|
||||
|
||||
bool sepstream::GetToken(std::string &token)
|
||||
{
|
||||
std::string::iterator lsp = last_starting_position;
|
||||
@@ -138,6 +148,14 @@ bool sepstream::GetToken(std::string &token)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sepstream::GetToken(ci::string &token)
|
||||
{
|
||||
std::string tmp_token;
|
||||
bool result = GetToken(tmp_token);
|
||||
token = tmp_token.c_str();
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string sepstream::GetRemaining()
|
||||
{
|
||||
return std::string(n, tokens.end());
|
||||
|
||||
+1
-1
@@ -188,4 +188,4 @@ const unsigned Version::GetMinor()
|
||||
const unsigned Version::GetBuild()
|
||||
{
|
||||
return Build;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -631,7 +631,7 @@ void Module::AddCallBack(Timer *t)
|
||||
{
|
||||
it2 = it;
|
||||
++it2;
|
||||
|
||||
|
||||
if (!TimerManager::IsTimer(*it))
|
||||
{
|
||||
this->CallBacks.erase(it);
|
||||
@@ -732,7 +732,7 @@ bool moduleMinVersion(int major, int minor, int patch, int build)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Module::NoticeLang(char *source, User * u, int number, ...)
|
||||
void Module::NoticeLang(const char *source, User * u, int number, ...)
|
||||
{
|
||||
va_list va;
|
||||
char buffer[4096], outbuf[4096];
|
||||
|
||||
Reference in New Issue
Block a user