Created
September 9, 2011 14:02
-
-
Save amyreese/1206300 to your computer and use it in GitHub Desktop.
Query Buffering Patch for ZNC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
Give this a go, applies, builds cleanly, and is functional on znc 0.202 on an Ubuntu 11.10 install:
http://paste.ubuntu.com/810415/
--chris
jonypoin's patch updated to compile against 1.0: https://gist.github.com/4710462
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.
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
Sorry for the delay in replying. I can't replicate this error on my end (Ubuntu 10.04) on a fresh copy of 0.202. Both hunks succeed, even with the offset (see below). Your patch output looks quite different from mine, are you using any sort of params that might be causing different behavior, or does FreeBSD use a different implementation of patch?
root@dyson /srv/source # wget http://znc.in/releases/znc-0.202.tar.gz
--2011-12-08 18:26:57-- http://znc.in/releases/znc-0.202.tar.gz
Resolving znc.in... 109.234.106.52
Connecting to znc.in|109.234.106.52|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 654083 (639K) [application/octet-stream]
Saving to: `znc-0.202.tar.gz'
100%[=====================================================================================>] 654,083 677K/s in 0.9s
2011-12-08 18:26:58 (677 KB/s) - `znc-0.202.tar.gz' saved [654083/654083]
root@dyson /srv/source # tar xf znc-0.202.tar.gz
root@dyson /srv/source # cd znc-0.202
root@dyson /srv/source/znc-0.202 # patch -p1 < ../znc-query-buffering.patch
patching file IRCSock.cpp
Hunk #1 succeeded at 812 (offset 88 lines).
patching file User.cpp
Hunk #1 succeeded at 537 (offset 247 lines).
root@dyson /srv/source/znc-0.202 #