From f3556bff57154c95ade5d006130c1c061a0c6e60 Mon Sep 17 00:00:00 2001 From: lotodore Date: Thu, 25 Oct 2007 19:50:43 +0000 Subject: [PATCH] Case-insensitive channel names for IRC. Fixed leaving admin players. --- src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp | 6 ++++++ src/net/common/ircthread.cpp | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp b/src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp index 00026802..5ff6aac4 100644 --- a/src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp +++ b/src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp @@ -114,6 +114,12 @@ void LobbyChat::playerLeft(QString playerName) QList tmpList(myLobby->treeWidget_NickList->findItems(playerName, Qt::MatchExactly)); if (!tmpList.empty()) myLobby->treeWidget_NickList->takeTopLevelItem(myLobby->treeWidget_NickList->indexOfTopLevelItem(tmpList.front())); + else + { + tmpList = myLobby->treeWidget_NickList->findItems("@" + playerName, Qt::MatchExactly); + if (!tmpList.empty()) + myLobby->treeWidget_NickList->takeTopLevelItem(myLobby->treeWidget_NickList->indexOfTopLevelItem(tmpList.front())); + } myLobby->treeWidget_NickList->sortItems(0, Qt::AscendingOrder); diff --git a/src/net/common/ircthread.cpp b/src/net/common/ircthread.cpp index 2b52d178..3f837039 100644 --- a/src/net/common/ircthread.cpp +++ b/src/net/common/ircthread.cpp @@ -24,11 +24,20 @@ #include #include #include +#include using namespace std; #define IRC_WAIT_TERMINATION_MSEC 500 +// Not using boost::algorithm here because of STL issues. +#ifdef _MSC_VER +#define STRCASECMP _stricmp +#else +#define STRCASECMP strcasecmp +#endif + + struct IrcContext { IrcContext(IrcThread &t) : ircThread(t), session(NULL), serverPort(0), useIPv6(false) {} @@ -154,7 +163,7 @@ irc_event_channel(irc_session_t *session, const char * /*irc_event*/, const char { IrcContext *context = (IrcContext *) irc_get_ctx(session); - if (count >= 2 && context->channel == params[0]) // check whether this message is for our channel + if (count >= 2 && STRCASECMP(context->channel.c_str(),params[0]) == 0) // check whether this message is for our channel { // Signal the message (if any) to GUI. if (*params[1] != 0)