]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspstring.cpp
Dump sendq before closing socket
[user/henk/code/inspircd.git] / src / inspstring.cpp
index f11ea1248b218fe3a4157957878bbad12fcf2496..816e37a19648027ac619734049e8869b796e1eb9 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -13,7 +13,7 @@
 
 /* $Core */
 
-#include "inspstring.h"
+#include "inspircd.h"
 
 /*
  * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -136,3 +136,19 @@ CoreExport bool charremove(char* mp, char remove)
 
        return shift_down;
 }
+
+static const char hextable[] = "0123456789abcdef";
+
+std::string BinToHex(const std::string& data)
+{
+       int l = data.length();
+       std::string rv;
+       rv.reserve(l * 2);
+       for(int i=0; i < l; i++)
+       {
+               unsigned char c = data[i];
+               rv.append(1, hextable[c >> 4]);
+               rv.append(1, hextable[c & 0xF]);
+       }
+       return rv;
+}