From e4a2c7aa8f248ff3205cecb427cd2e6cd9f38a6c Mon Sep 17 00:00:00 2001 From: prozacx Date: Mon, 16 May 2005 01:28:48 +0000 Subject: [PATCH] Added static function Concat() for catting a suffix onto a nick git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@313 726aef4b-f618-498e-8847-2d620e286838 --- Nick.cpp | 8 ++++++++ Nick.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Nick.cpp b/Nick.cpp index 3094ffd1..56c6effc 100644 --- a/Nick.cpp +++ b/Nick.cpp @@ -18,6 +18,14 @@ void CNick::Reset() { m_cPerm = '\0'; } +CString CNick::Concat(const CString& sNick, const CString& sSuffix, unsigned int uMaxNickLen) { + if (sSuffix.length() >= uMaxNickLen) { + return sSuffix.Left(uMaxNickLen); + } + + return sNick.Left(uMaxNickLen - sSuffix.length()) + sSuffix; +} + void CNick::Parse(const CString& sNickMask) { if (sNickMask.empty()) { return; diff --git a/Nick.h b/Nick.h index 845ff309..0533a2bf 100644 --- a/Nick.h +++ b/Nick.h @@ -23,6 +23,7 @@ public: void Parse(const CString& sNickMask); CString GetHostMask() const; unsigned int GetCommonChans(vector& vChans, CUser* pUser) const; + static CString Concat(const CString& sNick, const CString& sSuffix, unsigned int uMaxNickLen = 9); // Setters void SetUser(CUser* pUser);