summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2013-06-05 17:52:39 -0700
committerAttila Molnar <attilamolnar@hush.com>2013-06-05 17:52:39 -0700
commitf00ac52c5d593fcb761fc316b2582bb06158035c (patch)
treebec88a8a69c4a912606636c9df6283c154962fef /include
parentd9d99cd02dadf34bfcc220734ba0c422f0acb3e6 (diff)
parent5d0b2b7cfccf057e7abab94c41065f94420899cd (diff)
Merge pull request #544 from SaberUK/master+kill-maxbuf
Purge MAXBUF in favour of a configuration option.
Diffstat (limited to 'include')
-rw-r--r--include/configreader.h14
-rw-r--r--include/inspircd.h19
-rw-r--r--include/users.h10
3 files changed, 22 insertions, 21 deletions
diff --git a/include/configreader.h b/include/configreader.h
index cc1412096..a17c5cf3e 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -93,14 +93,16 @@ class ServerLimits
size_t MaxGecos;
/** Maximum away message length */
size_t MaxAway;
+ /** Maximum line length */
+ size_t MaxLine;
/** Creating the class initialises it to the defaults
* as in 1.1's ./configure script. Reading other values
* from the config will change these values.
*/
- ServerLimits() : NickMax(31), ChanMax(64), MaxModes(20), IdentMax(12), MaxQuit(255), MaxTopic(307), MaxKick(255), MaxGecos(128), MaxAway(200)
- {
- }
+ ServerLimits() : NickMax(31), ChanMax(64), MaxModes(20), IdentMax(12),
+ MaxQuit(255), MaxTopic(307), MaxKick(255), MaxGecos(128), MaxAway(200),
+ MaxLine(512) { }
};
struct CommandLineConf
@@ -519,6 +521,12 @@ class CoreExport ServerConfig
* @return True if the file exists and is readable.
*/
static bool FileExists(const char* file);
+
+ /** Escapes a value for storage in a configuration key.
+ * @param str The string to escape.
+ * @param xml Are we using the XML config format?
+ */
+ static std::string Escape(const std::string& str, bool xml = true);
/** If this value is true, invites will bypass more than just +i
*/
diff --git a/include/inspircd.h b/include/inspircd.h
index 957032da2..f86945903 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -82,20 +82,19 @@ CoreExport extern InspIRCd* ServerInstance;
*/
template<typename T> inline std::string ConvNumeric(const T &in)
{
- if (in == 0) return "0";
- char res[MAXBUF];
- char* out = res;
+ if (in == 0)
+ return "0";
T quotient = in;
- while (quotient) {
- *out = "0123456789"[ std::abs( (long)quotient % 10 ) ];
- ++out;
+ std::string out;
+ while (quotient)
+ {
+ out += "0123456789"[ std::abs( (long)quotient % 10 ) ];
quotient /= 10;
}
if (in < 0)
- *out++ = '-';
- *out = 0;
- std::reverse(res,out);
- return res;
+ out += '-';
+ std::reverse(out.begin(), out.end());
+ return out;
}
/** Template function to convert any input type to std::string
diff --git a/include/users.h b/include/users.h
index 52f3e4a88..941e57667 100644
--- a/include/users.h
+++ b/include/users.h
@@ -403,7 +403,7 @@ class CoreExport User : public Extensible
/** Create a displayable mode string for this users snomasks
* @return The notice mask character sequence
*/
- const char* FormatNoticeMasks();
+ std::string FormatNoticeMasks();
/** Process a snomask modifier string, e.g. +abc-de
* @param sm A sequence of notice mask characters
@@ -481,12 +481,6 @@ class CoreExport User : public Extensible
*/
virtual bool HasModePermission(unsigned char mode, ModeType type);
- /** Creates a wildcard host.
- * Takes a buffer to use and fills the given buffer with the host in the format *!*\@hostname
- * @return The wildcarded hostname in *!*\@host form
- */
- char* MakeWildHost();
-
/** Creates a usermask with real host.
* Takes a buffer to use and fills the given buffer with the hostmask in the format user\@host
* @return the usermask in the format user\@host
@@ -607,7 +601,7 @@ class CoreExport User : public Extensible
* @param LinePrefix text to prefix each complete line with
* @param TextStream the text to send to the user
*/
- void SendText(const std::string &LinePrefix, std::stringstream &TextStream);
+ void SendText(const std::string& linePrefix, std::stringstream& textStream);
/** Write to the user, routing the line if the user is remote.
*/