Skip to content

Instantly share code, notes, and snippets.

@amyreese
Created February 4, 2013 22:48
Show Gist options
  • Save amyreese/4710462 to your computer and use it in GitHub Desktop.
Save amyreese/4710462 to your computer and use it in GitHub Desktop.
diff -urN '--exclude=CVS' '--exclude=.svn' '--exclude=.git*' '--exclude=*.swp' znc-1.0/src/Client.cpp znc-1.0-query-buffer/src/Client.cpp
--- znc-1.0/src/Client.cpp 2012-11-06 08:02:20.000000000 -0800
+++ znc-1.0-query-buffer/src/Client.cpp 2013-02-04 14:30:49.240504205 -0800
@@ -306,17 +306,29 @@
}
// Relay to the rest of the clients that may be connected to this user
- if (m_pNetwork->IsChan(sTarget)) {
+ //if (m_pNetwork->IsChan(sTarget)) {
vector<CClient*>& vClients = GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {
CClient* pClient = vClients[a];
- if (pClient != this) {
- pClient->PutClient(":" + GetNickMask() + " PRIVMSG " + sTarget + " :\001" + sCTCP + "\001");
+ //if (pClient != this) {
+ //pClient->PutClient(":" + GetNickMask() + " PRIVMSG " + sTarget + " :\001" + sCTCP + "\001");
+ //}
+
+ if (m_pNetwork->IsChan(sTarget)) {
+ if (pClient != this) {
+ pClient->PutClient(":" + GetNickMask() + " PRIVMSG " + sTarget + " :\001" + sCTCP + "\001");
+ }
+ } else {
+ if (pClient == this) {
+ m_pNetwork->AddQueryBuffer(":" + sTarget + " PRIVMSG ", GetNick() + " :\001ACTION <***> * " + GetNick() + " " + m_pUser->AddTimestamp(sMessage) + "\001");
+ } else {
+ pClient->PutClient(":" + sTarget + " PRIVMSG " + GetNick() + " :\001ACTION <***> * " + GetNick() + " " + sMessage + "\001");
+ }
}
}
- }
+ //}
} else {
NETWORKMODULECALL(OnUserCTCP(sTarget, sCTCP), m_pUser, m_pNetwork, this, &bReturn);
if (bReturn) return;
@@ -359,17 +371,29 @@
// Relay to the rest of the clients that may be connected to this user
- if (m_pNetwork->IsChan(sTarget)) {
+ //if (m_pNetwork->IsChan(sTarget)) {
vector<CClient*>& vClients = GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {
CClient* pClient = vClients[a];
- if (pClient != this) {
- pClient->PutClient(":" + GetNickMask() + " PRIVMSG " + sTarget + " :" + sMsg);
+ //if (pClient != this) {
+ //pClient->PutClient(":" + GetNickMask() + " PRIVMSG " + sTarget + " :" + sMsg);
+ //}
+
+ if (m_pNetwork->IsChan(sTarget)) {
+ if (pClient != this) {
+ pClient->PutClient(":" + GetNickMask() + " PRIVMSG " + sTarget + " :" + sMsg);
+ }
+ } else {
+ if (pClient == this) {
+ m_pNetwork->AddQueryBuffer(":" + sTarget + " PRIVMSG ", GetNick() + " :<***> <" + GetNick() + "> " + m_pUser->AddTimestamp(sMsg));
+ } else {
+ pClient->PutClient(":" + sTarget + " PRIVMSG " + GetNick() + " :<***> <" + GetNick() + "> " + sMsg);
+ }
}
}
- }
+ //}
}
return;
diff -urN '--exclude=CVS' '--exclude=.svn' '--exclude=.git*' '--exclude=*.swp' znc-1.0/src/IRCSock.cpp znc-1.0-query-buffer/src/IRCSock.cpp
--- znc-1.0/src/IRCSock.cpp 2012-11-06 08:02:20.000000000 -0800
+++ znc-1.0-query-buffer/src/IRCSock.cpp 2013-02-04 14:34:51.013845327 -0800
@@ -853,10 +853,10 @@
IRCSOCKMODULECALL(OnPrivAction(Nick, sMessage), &bResult);
if (bResult) return true;
- if (!m_pNetwork->IsUserOnline()) {
+ //if (!m_pNetwork->IsUserOnline()) {
// If the user is detached, add to the buffer
m_pNetwork->AddQueryBuffer(":" + _NAMEDFMT(Nick.GetNickMask()) + " PRIVMSG {target} :\001ACTION {text}\001", sMessage);
- }
+ //}
sMessage = "ACTION " + sMessage;
}
@@ -914,10 +914,10 @@
IRCSOCKMODULECALL(OnPrivNotice(Nick, sMessage), &bResult);
if (bResult) return true;
- if (!m_pNetwork->IsUserOnline()) {
+ //if (!m_pNetwork->IsUserOnline()) {
// If the user is detached, add to the buffer
m_pNetwork->AddQueryBuffer(":" + _NAMEDFMT(Nick.GetNickMask()) + " NOTICE {target} :{text}", sMessage);
- }
+ //}
return false;
}
@@ -927,10 +927,10 @@
IRCSOCKMODULECALL(OnPrivMsg(Nick, sMessage), &bResult);
if (bResult) return true;
- if (!m_pNetwork->IsUserOnline()) {
+ //if (!m_pNetwork->IsUserOnline()) {
// If the user is detached, add to the buffer
m_pNetwork->AddQueryBuffer(":" + _NAMEDFMT(Nick.GetNickMask()) + " PRIVMSG {target} :{text}", sMessage);
- }
+ //}
return false;
}
@d4g
Copy link

d4g commented May 13, 2013

I actually preferred the orignal patch much more, where the messages were jsut pushed into the buffer and every client that connetcts gets the whole buffer. The new patch(es) fail to do this for me and also add some weird appearing chat messages marked with 3 stars.

Could you upgrade your original patch to znc 1.0 ?

@d4g
Copy link

d4g commented May 13, 2013

Also, if I quit the "last" connected client and reconnect, I get a query with empty chat messages ... this looks weird. Bugged?

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