summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h14
-rw-r--r--src/users.cpp19
2 files changed, 27 insertions, 6 deletions
diff --git a/include/users.h b/include/users.h
index 003123b0b..018336e77 100644
--- a/include/users.h
+++ b/include/users.h
@@ -515,11 +515,17 @@ class userrec : public connection
*/
char* MakeWildHost();
- /** Creates a host.
- * Takes a buffer to use and fills the given buffer with the host in the format nick!user@host
- * @param Buffer to fill with host information
+ /** 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
*/
- void MakeHost(char* nhost);
+ char* MakeHost();
+
+ /** Creates a usermask with real ip.
+ * Takes a buffer to use and fills the given buffer with the ipmask in the format user@ip
+ * @return the usermask in the format user@ip
+ */
+ char* MakeHostIP();
/** Shuts down and closes the user's socket
* This will not cause the user to be deleted. Use InspIRCd::QuitUser for this,
diff --git a/src/users.cpp b/src/users.cpp
index 4437449e3..a79f0a61d 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -339,9 +339,9 @@ userrec::~userrec()
}
}
-/* XXX - minor point, other *Host functions return a char *, this one creates it. Might be nice to be consistant? */
-void userrec::MakeHost(char* nhost)
+char* userrec::MakeHost()
{
+ static char nhost[MAXBUF];
/* This is much faster than snprintf */
char* t = nhost;
for(char* n = ident; *n; n++)
@@ -350,6 +350,21 @@ void userrec::MakeHost(char* nhost)
for(char* n = host; *n; n++)
*t++ = *n;
*t = 0;
+ return nhost;
+}
+
+char* userrec::MakeHostIP()
+{
+ static char ihost[MAXBUF];
+ /* This is much faster than snprintf */
+ char* t = ihost;
+ for(char* n = ident; *n; n++)
+ *t++ = *n;
+ *t++ = '@';
+ for(const char* n = this->GetIPString(); *n; n++)
+ *t++ = *n;
+ *t = 0;
+ return ihost;
}
void userrec::CloseSocket()