[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeextragear-2/konversation/konversation
From: John Tapsell <john () geola ! co ! uk>
Date: 2004-08-31 22:41:35
Message-ID: 20040831224135.984B190FC () office ! kde ! org
[Download RAW message or body]
CVS commit by johnflux:
Fixed a bug so that we now allow nicks to have both op and voice at the same time.
M +1 -1 inputfilter.cpp 1.129
M +29 -43 server.cpp 1.272
M +2 -2 server.h 1.132
--- kdeextragear-2/konversation/konversation/inputfilter.cpp #1.128:1.129
@@ -868,5 +868,5 @@ void InputFilter::parseServerCommand(con
// remove possible mode characters from nickname and store the resulting \
mode
- server->mangleNicknameWithModes(nickname,admin,owner,op,halfop,voice,NULL);
+ server->mangleNicknameWithModes(nickname,admin,owner,op,halfop,voice);
// TODO: make these an enumeration in KApplication or somewhere, we can \
use them from channel.cpp as well
--- kdeextragear-2/konversation/konversation/server.cpp #1.271:1.272
@@ -473,6 +473,6 @@ void Server::setPrefixes(const QString &
// return a nickname without possible mode character at the beginning
-bool Server::mangleNicknameWithModes(QString& nickname,bool& isAdmin,bool& isOwner,
- bool& isOp,bool& isHalfop,bool& hasVoice,char* \
realMode ) +void Server::mangleNicknameWithModes(QString& nickname,bool& \
isAdmin,bool& isOwner, + bool& isOp,bool& \
isHalfop,bool& hasVoice) {
isAdmin=false;
@@ -481,26 +481,15 @@ bool Server::mangleNicknameWithModes(QSt
isHalfop=false;
hasVoice=false;
-
- if(realMode)
- {
- *realMode=' ';
- }
- // try to find a prefix
- int modeIndex=serverNickPrefixes.find(nickname[0]);
- if(modeIndex==-1)
- {
- // nothing to do, if it was not found.
- // remember that we've set up RFC1459 compatible serverNickPrefixes
- return false;
- }
- if(realMode)
- {
- *realMode=nickname[0].latin1();
- }
- // cut off the prefix
+ int modeIndex;
+ Q_ASSERT(!nickname.isEmpty()); if(nickname.isEmpty()) return;
+ while( (modeIndex=serverNickPrefixes.find(nickname[0])) != -1) {
+ Q_ASSERT(!nickname.isEmpty()); if(nickname.isEmpty()) return;
nickname=nickname.mid(1);
+ // cut off the prefix
+ bool recognisedMode=false;
// determine, whether status is like op or like voice
- while(static_cast<unsigned int>(modeIndex)<serverNickPrefixes.length())
+ while((modeIndex)<int(serverNickPrefixes.length()) && !recognisedMode)
{
+
switch(serverNickPrefixes[modeIndex].latin1())
{
@@ -508,25 +497,25 @@ bool Server::mangleNicknameWithModes(QSt
{
isAdmin=true;
- return true;
+ recognisedMode=true;
}
case '!': // channel owner (RFC2811)
{
isOwner=true;
- return true;
+ recognisedMode=true;
}
case '@': // channel operator (RFC1459)
{
isOp=true;
- return true;
+ recognisedMode=true;
}
case '%': // halfop
{
isHalfop=true;
- return true;
+ recognisedMode=true;
}
case '+': // voiced (RFC1459)
{
hasVoice=true;
- return true;
+ recognisedMode=true;
}
default:
@@ -535,10 +524,7 @@ bool Server::mangleNicknameWithModes(QSt
break;
}
- }
- } // endwhile
-
- // a mode was used, which has lower priority than voice.
- // (Not seen an ircd which supports this, yet)
- return true;
+ } //switch to recognise the mode.
+ } // loop through the modes to find one recognised
+ } // loop through the name
}
--- kdeextragear-2/konversation/konversation/server.h #1.131:1.132
@@ -100,6 +100,6 @@ class Server : public QObject
// extended user modes support
void setPrefixes(const QString &modes, const QString& prefixes);
- bool mangleNicknameWithModes(QString &nickname,bool& isAdmin,bool& isOwner,bool \
&isOp,
- bool& isHalfop,bool &hasVoice,char *realMode );
+ void mangleNicknameWithModes(QString &nickname,bool& isAdmin,bool& isOwner,bool \
&isOp, + bool& isHalfop,bool &hasVoice);
bool isNickname(const QString& compare);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic