daily pastebin goal
87%
SHARE
TWEET

Untitled

a guest Jan 28th, 2013 563 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Copyright (C) 2009 flakes @ EFNet
  3.  * See the AUTHORS file for details.
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify it
  6.  * under the terms of the GNU General Public License version 2 as published
  7.  * by the Free Software Foundation.
  8.  */
  9.  
  10. #include <znc/IRCNetwork.h>
  11. #include <znc/User.h>
  12.  
  13. class CFixLagChkMod : public CModule
  14. {
  15. private:
  16.         typedef TCacheMap<const CString, CClient*> TWaitingMap;
  17.         TWaitingMap m_waiting;
  18. public:
  19.         MODCONSTRUCTOR(CFixLagChkMod)
  20.         {
  21.                 m_waiting.SetTTL(1000 * 120); // 2 minutes...
  22.         }
  23.  
  24.         EModRet OnUserNotice(CString& sTarget, CString& sMessage)
  25.         {
  26.                 if(m_pClient && sTarget.Equals(m_pNetwork->GetIRCNick().GetNick()) &&
  27.                         sMessage.Token(0).Equals("LAGCHK"))
  28.                 {
  29.                         m_waiting.AddItem(sMessage, m_pClient);
  30.                 }
  31.  
  32.                 return CONTINUE;
  33.         }
  34.  
  35.         EModRet OnPrivNotice(CNick& Nick, CString& sMessage)
  36.         {
  37.                 if(Nick.GetNick().Equals(m_pNetwork->GetIRCNick().GetNick()) &&
  38.                         sMessage.Token(0).Equals("LAGCHK"))
  39.                 {
  40.                         CClient **client = m_waiting.GetItem(sMessage);
  41.  
  42.                         if(client)
  43.                         {
  44.                                 (*client)->PutClient(":" + m_pNetwork->GetIRCNick().GetHostMask() +
  45.                                         " NOTICE " + m_pNetwork->GetIRCNick().GetNick() + " :" + sMessage);
  46.                         }
  47.  
  48.                         return HALT;
  49.                 }
  50.  
  51.                 return CONTINUE;
  52.         }
  53.  
  54.         void OnClientDisconnect()
  55.         {
  56.                 m_waiting.Clear();
  57.         }
  58. };
  59.  
  60. MODULEDEFS(CFixLagChkMod, "Fixes NoNameScript's and other clients' LAGCHK stuff by sending it to the correct client only.")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top