Permalink
Browse files

Initial revision

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2 726aef4b-f618-498e-8847-2d620e286838
  • Loading branch information...
1 parent 71a0088 commit 538d3ece4e737807e7d5a11849aab177b87c1571 prozacx committed Aug 24, 2004
Showing with 10,362 additions and 0 deletions.
  1. +52 −0 Buffer.cpp
  2. +45 −0 Buffer.h
  3. +311 −0 Chan.cpp
  4. +123 −0 Chan.h
  5. +28 −0 CreatePem.sh
  6. +2,545 −0 Csocket.h
  7. +130 −0 DCCBounce.cpp
  8. +98 −0 DCCBounce.h
  9. +156 −0 DCCSock.cpp
  10. +108 −0 DCCSock.h
  11. +742 −0 IRCSock.cpp
  12. +72 −0 IRCSock.h
  13. +31 −0 Makefile
  14. +594 −0 Modules.cpp
  15. +174 −0 Modules.h
  16. +62 −0 Nick.cpp
  17. +44 −0 Nick.h
  18. +17 −0 Server.cpp
  19. +23 −0 Server.h
  20. +49 −0 Timers.h
  21. +397 −0 User.cpp
  22. +124 −0 User.h
  23. +846 −0 UserSock.cpp
  24. +73 −0 UserSock.h
  25. +687 −0 Utils.cpp
  26. +291 −0 Utils.h
  27. +92 −0 main.cpp
  28. +17 −0 main.h
  29. +283 −0 md5.cpp
  30. +56 −0 md5.h
  31. +45 −0 modules/buildmod
  32. +269 −0 modules/email.cc
  33. +28 −0 modules/raw.cpp
  34. +198 −0 modules/sample.cpp
  35. +211 −0 modules/savebuff.cc
  36. +462 −0 modules/schat.cc
  37. +220 −0 modules/shell.cpp
  38. +95 −0 znc.conf
  39. +471 −0 znc.cpp
  40. +68 −0 znc.h
  41. +25 −0 zncchk
View
@@ -0,0 +1,52 @@
+#include "Buffer.h"
+
+CBufLine::CBufLine(const string& sPre, const string& sPost) {
+ m_sPre = sPre;
+ m_sPost = sPost;
+}
+
+CBufLine::~CBufLine() {}
+
+void CBufLine::GetLine(const string& sTarget, string& sRet) {
+ sRet = m_sPre + sTarget + m_sPost;
+}
+
+CBuffer::CBuffer(unsigned int uLineCount) {
+ m_uLineCount = uLineCount;
+}
+
+CBuffer::~CBuffer() {}
+
+int CBuffer::AddLine(const string& sPre, const string& sPost) {
+ if (!m_uLineCount) {
+ return 0;
+ }
+
+ if (size() >= m_uLineCount) {
+ erase(begin());
+ }
+
+ push_back(CBufLine(sPre, sPost));
+ return size();
+}
+
+bool CBuffer::GetLine(const string& sTarget, string& sRet, unsigned int uIdx) {
+ if (uIdx >= size()) {
+ return false;
+ }
+
+ (*this)[uIdx].GetLine(sTarget, sRet);
+ return true;
+}
+
+bool CBuffer::GetNextLine(const string& sTarget, string& sRet) {
+ sRet = "";
+
+ if (!size()) {
+ return false;
+ }
+
+ begin()->GetLine(sTarget, sRet);
+ erase(begin());
+ return true;
+}
View
@@ -0,0 +1,45 @@
+#ifndef _BUFFER_H
+#define _BUFFER_H
+
+#include <string>
+#include <vector>
+using std::vector;
+using std::string;
+
+class CBufLine {
+public:
+ CBufLine(const string& sPre, const string& sPost);
+ virtual ~CBufLine();
+ void GetLine(const string& sTarget, string& sRet);
+
+private:
+protected:
+ string m_sPre;
+ string m_sPost;
+};
+
+class CBuffer : private vector<CBufLine> {
+public:
+ CBuffer(unsigned int uLineCount = 100);
+ virtual ~CBuffer();
+
+ int AddLine(const string& sPre, const string& sPost);
+ bool GetNextLine(const string& sTarget, string& sRet);
+ bool GetLine(const string& sTarget, string& sRet, unsigned int uIdx);
+ bool IsEmpty() { return empty(); }
+ void Clear() { clear(); }
+
+ // Setters
+ void SetLineCount(unsigned int u) { m_uLineCount = u; }
+ // !Setters
+
+ // Getters
+ unsigned int GetLineCount() const { return m_uLineCount; }
+ // !Getters
+private:
+protected:
+ unsigned int m_uLineCount;
+};
+
+#endif // !_BUFFER_H
+
Oops, something went wrong.

0 comments on commit 538d3ec

Please sign in to comment.