Skip to content

Instantly share code, notes, and snippets.

@amyreese
Created September 9, 2011 14:02
Show Gist options
  • Save amyreese/1206300 to your computer and use it in GitHub Desktop.
Save amyreese/1206300 to your computer and use it in GitHub Desktop.
Query Buffering Patch for ZNC
This patch make ZNC query buffering behave the way I like, as I use
multiple clients and still want the query buffer to be filled and replayed
for the newly connecting client.
diff -rup znc-0.074/IRCSock.cpp znc/IRCSock.cpp
--- znc-0.074/IRCSock.cpp 2009-06-29 13:26:19 +0200
+++ znc/IRCSock.cpp 2009-08-26 11:30:56 +0200
@@ -724,21 +724,14 @@ bool CIRCSock::OnGeneralCTCP(CNick& Nick
bool CIRCSock::OnPrivNotice(CNick& Nick, CString& sMessage) {
MODULECALL(OnPrivNotice(Nick, sMessage), m_pUser, NULL, return true);
- if (!m_pUser->IsUserAttached()) {
- // If the user is detached, add to the buffer
- m_pUser->AddQueryBuffer(":" + Nick.GetNickMask() + " NOTICE ", " :" + m_pUser->AddTimestamp(sMessage));
- }
+ m_pUser->AddQueryBuffer(":" + Nick.GetNickMask() + " NOTICE ", " :" + m_pUser->AddTimestamp(sMessage));
return false;
}
bool CIRCSock::OnPrivMsg(CNick& Nick, CString& sMessage) {
MODULECALL(OnPrivMsg(Nick, sMessage), m_pUser, NULL, return true);
-
- if (!m_pUser->IsUserAttached()) {
- // If the user is detached, add to the buffer
- m_pUser->AddQueryBuffer(":" + Nick.GetNickMask() + " PRIVMSG ", " :" + m_pUser->AddTimestamp(sMessage));
- }
+ m_pUser->AddQueryBuffer(":" + Nick.GetNickMask() + " PRIVMSG ", " :" + m_pUser->AddTimestamp(sMessage));
return false;
}
diff -rup znc-0.074/User.cpp znc/User.cpp
--- znc-0.074/User.cpp 2009-07-22 18:54:52 +0200
+++ znc/User.cpp 2009-08-26 11:30:56 +0200
@@ -290,6 +290,7 @@ void CUser::UserConnected(CClient* pClie
MODULECALL(OnPrivBufferPlayLine(*pClient, sBufLine), this, NULL, continue);
pClient->PutClient(sBufLine);
}
+ m_QueryBuffer.Clear();
// Tell them why they won't connect
if (!GetIRCConnectEnabled())
@amyreese
Copy link
Author

amyreese commented Feb 4, 2013

jonypoin's patch updated to compile against 1.0: https://gist.github.com/4710462

@d4g
Copy link

d4g commented May 13, 2013

Can you recreate the features of the original patch? Always everything in the query buffer? No stars?

With the latest patch, I am additionally having a weird behavior. On reconnect of the last clients, I get many emtpy messages in the query. On my iPad client, when I conenct to the server, the client crashes immediately and I have to restart it. Then I get no querybuffer.

@omgjlk
Copy link

omgjlk commented Apr 4, 2014

I've updated the original patch for 1.2 and improved upon it. See znc/znc#521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment