Skip to content

Commit

Permalink
Fix echo-message for *status
Browse files Browse the repository at this point in the history
Close #1705
  • Loading branch information
DarthGandalf committed Mar 29, 2020
1 parent 6d1ef8d commit d229761
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,8 @@ bool CClient::OnTextMessage(CTextMessage& Message) {
}

if (sTarget.TrimPrefix(m_pUser->GetStatusPrefix())) {
EchoMessage(Message);

if (sTarget.Equals("status")) {
CString sMsg = Message.GetText();
UserCommand(sMsg);
Expand Down
16 changes: 14 additions & 2 deletions test/integration/tests/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* limitations under the License.
*/

#include "znctest.h"
#include <gmock/gmock.h>

#include "znctest.h"

using testing::HasSubstr;

namespace znc_inttest {
Expand Down Expand Up @@ -244,7 +245,8 @@ TEST_F(ZNCTest, AwayNotify) {
client.Write("USER user/test x x :x");
QByteArray cap_ls;
client.ReadUntilAndGet(" LS :", cap_ls);
ASSERT_THAT(cap_ls.toStdString(), AllOf(HasSubstr("cap-notify"), Not(HasSubstr("away-notify"))));
ASSERT_THAT(cap_ls.toStdString(),
AllOf(HasSubstr("cap-notify"), Not(HasSubstr("away-notify"))));
client.Write("CAP REQ :cap-notify");
client.ReadUntil("ACK :cap-notify");
client.Write("CAP END");
Expand Down Expand Up @@ -284,5 +286,15 @@ TEST_F(ZNCTest, JoinKey) {
ircd.ReadUntil("JOIN #znc secret");
}

TEST_F(ZNCTest, StatusEchoMessage) {
auto znc = Run();
auto ircd = ConnectIRCd();
auto client = LoginClient();
client.Write("CAP REQ :echo-message");
client.Write("PRIVMSG *status :blah");
client.ReadUntil(":nick!user@irc.znc.in PRIVMSG *status :blah");
client.ReadUntil(":*status!znc@znc.in PRIVMSG nick :Unknown command");
}

} // namespace
} // namespace znc_inttest

0 comments on commit d229761

Please sign in to comment.