@ -64,7 +64,7 @@
int Server : : m_availableConnectionId = 0 ;
int Server : : m_availableConnectionId = 0 ;
Server : : Server ( TQObject * tq parent, ConnectionSettings & settings ) : TQObject ( tq parent)
Server : : Server ( TQObject * parent, ConnectionSettings & settings ) : TQObject ( parent)
{
{
m_connectionId = m_availableConnectionId ;
m_connectionId = m_availableConnectionId ;
m_availableConnectionId + + ;
m_availableConnectionId + + ;
@ -1039,11 +1039,11 @@ int Server::getPreLength(const TQString& command, const TQString& dest)
int hostMaskLength = 0 ;
int hostMaskLength = 0 ;
if ( info )
if ( info )
hostMaskLength = info - > getHost tq mask( ) . length ( ) ;
hostMaskLength = info - > getHost mask( ) . length ( ) ;
//:Sho_!i=ehs1@konversation/developer/hein PRIVMSG #konversation :and then back to it
//:Sho_!i=ehs1@konversation/developer/hein PRIVMSG #konversation :and then back to it
//<colon>$nickname<!>$host tq mask<space>$command<space>$destination<space><colon>$message<cr><lf>
//<colon>$nickname<!>$host mask<space>$command<space>$destination<space><colon>$message<cr><lf>
int x = 512 - 8 - ( m_nickname . length ( ) + hostMaskLength + command . length ( ) + dest . length ( ) ) ;
int x = 512 - 8 - ( m_nickname . length ( ) + hostMaskLength + command . length ( ) + dest . length ( ) ) ;
return x ;
return x ;
@ -1461,8 +1461,8 @@ class Query* Server::addQuery(const NickInfoPtr & nickInfo, bool weinitiated)
static_cast < KonversationApplication * > ( kapp ) - > notificationHandler ( ) - > query ( query , nickname ) ;
static_cast < KonversationApplication * > ( kapp ) - > notificationHandler ( ) - > query ( query , nickname ) ;
}
}
// try to get host tq mask if there's none yet
// try to get host mask if there's none yet
if ( query - > getNickInfo ( ) - > getHost tq mask( ) . isEmpty ( ) ) requestUserhost ( nickname ) ;
if ( query - > getNickInfo ( ) - > getHost mask( ) . isEmpty ( ) ) requestUserhost ( nickname ) ;
Q_ASSERT ( query ) ;
Q_ASSERT ( query ) ;
@ -1536,50 +1536,50 @@ void Server::resolveUserhost(const TQString& nickname)
void Server : : requestBan ( const TQStringList & users , const TQString & channel , const TQString & a_option )
void Server : : requestBan ( const TQStringList & users , const TQString & channel , const TQString & a_option )
{
{
TQString host tq mask;
TQString host mask;
TQString option = a_option . lower ( ) ;
TQString option = a_option . lower ( ) ;
Channel * targetChannel = getChannelByName ( channel ) ;
Channel * targetChannel = getChannelByName ( channel ) ;
for ( unsigned int index = 0 ; index < users . count ( ) ; index + + )
for ( unsigned int index = 0 ; index < users . count ( ) ; index + + )
{
{
// first, set the ban tq mask to the specified nick
// first, set the ban mask to the specified nick
TQString tq mask= users [ index ] ;
TQString mask= users [ index ] ;
// did we specify an option?
// did we specify an option?
if ( ! option . isEmpty ( ) )
if ( ! option . isEmpty ( ) )
{
{
// try to find specified nick on the channel
// try to find specified nick on the channel
Nick * targetNick = targetChannel - > getNickByName ( tq mask) ;
Nick * targetNick = targetChannel - > getNickByName ( mask) ;
// if we found the nick try to find their host tq mask
// if we found the nick try to find their host mask
if ( targetNick )
if ( targetNick )
{
{
TQString host tq mask= targetNick - > getChannelNick ( ) - > getHost tq mask( ) ;
TQString host mask= targetNick - > getChannelNick ( ) - > getHost mask( ) ;
// if we found the host tq mask, add it to the ban tq mask
// if we found the host mask, add it to the ban mask
if ( ! host tq mask. isEmpty ( ) )
if ( ! host mask. isEmpty ( ) )
{
{
tq mask= targetNick - > getChannelNick ( ) - > getNickname ( ) + ' ! ' + host tq mask;
mask= targetNick - > getChannelNick ( ) - > getNickname ( ) + ' ! ' + host mask;
// adapt ban tq mask to the option given
// adapt ban mask to the option given
if ( option = = " host " )
if ( option = = " host " )
tq mask= " *!*@*. " + host tq mask. section ( ' . ' , 1 ) ;
mask= " *!*@*. " + host mask. section ( ' . ' , 1 ) ;
else if ( option = = " domain " )
else if ( option = = " domain " )
tq mask= " *!*@ " + host tq mask. section ( ' @ ' , 1 ) ;
mask= " *!*@ " + host mask. section ( ' @ ' , 1 ) ;
else if ( option = = " userhost " )
else if ( option = = " userhost " )
tq mask= " *! " + host tq mask. section ( ' @ ' , 0 , 0 ) + " @*. " + host tq mask. section ( ' . ' , 1 ) ;
mask= " *! " + host mask. section ( ' @ ' , 0 , 0 ) + " @*. " + host mask. section ( ' . ' , 1 ) ;
else if ( option = = " userdomain " )
else if ( option = = " userdomain " )
tq mask= " *! " + host tq mask. section ( ' @ ' , 0 , 0 ) + ' @ ' + host tq mask. section ( ' @ ' , 1 ) ;
mask= " *! " + host mask. section ( ' @ ' , 0 , 0 ) + ' @ ' + host mask. section ( ' @ ' , 1 ) ;
}
}
}
}
}
}
Konversation : : OutputFilterResult result = getOutputFilter ( ) - > execBan ( tq mask, channel ) ;
Konversation : : OutputFilterResult result = getOutputFilter ( ) - > execBan ( mask, channel ) ;
queue ( result . toServer ) ;
queue ( result . toServer ) ;
}
}
}
}
void Server : : requestUnban ( const TQString & tq mask, const TQString & channel )
void Server : : requestUnban ( const TQString & mask, const TQString & channel )
{
{
Konversation : : OutputFilterResult result = getOutputFilter ( ) - > execUnban ( tq mask, channel ) ;
Konversation : : OutputFilterResult result = getOutputFilter ( ) - > execUnban ( mask, channel ) ;
queue ( result . toServer ) ;
queue ( result . toServer ) ;
}
}
@ -1969,7 +1969,7 @@ void Server::sendJoinCommand(const TQString& name, const TQString& password)
queue ( result . toServer ) ;
queue ( result . toServer ) ;
}
}
void Server : : joinChannel ( const TQString & name , const TQString & host tq mask)
void Server : : joinChannel ( const TQString & name , const TQString & host mask)
{
{
// (re-)join channel, open a new panel if needed
// (re-)join channel, open a new panel if needed
Channel * channel = getChannelByName ( name ) ;
Channel * channel = getChannelByName ( name ) ;
@ -1997,10 +1997,10 @@ void Server::joinChannel(const TQString& name, const TQString& hosttqmask)
// Move channel from unjoined (if present) to joined list and add our own nickname to the joined list.
// Move channel from unjoined (if present) to joined list and add our own nickname to the joined list.
ChannelNickPtr channelNick = addNickToJoinedChannelsList ( name , getNickname ( ) ) ;
ChannelNickPtr channelNick = addNickToJoinedChannelsList ( name , getNickname ( ) ) ;
if ( ( channelNick - > getHost tq mask( ) ! = host tq mask ) & & ! host tq mask. isEmpty ( ) )
if ( ( channelNick - > getHost mask( ) ! = host mask ) & & ! host mask. isEmpty ( ) )
{
{
NickInfoPtr nickInfo = channelNick - > getNickInfo ( ) ;
NickInfoPtr nickInfo = channelNick - > getNickInfo ( ) ;
nickInfo - > setHost tq mask( host tq mask) ;
nickInfo - > setHost mask( host mask) ;
}
}
channel - > joinNickname ( channelNick ) ;
channel - > joinNickname ( channelNick ) ;
@ -2548,7 +2548,7 @@ void Server::renameNickInfo(NickInfoPtr nickInfo, const TQString& newname)
}
}
}
}
Channel * Server : : nickJoinsChannel ( const TQString & channelName , const TQString & nickname , const TQString & host tq mask)
Channel * Server : : nickJoinsChannel ( const TQString & channelName , const TQString & nickname , const TQString & host mask)
{
{
Channel * outChannel = getChannelByName ( channelName ) ;
Channel * outChannel = getChannelByName ( channelName ) ;
if ( outChannel )
if ( outChannel )
@ -2556,9 +2556,9 @@ Channel* Server::nickJoinsChannel(const TQString &channelName, const TQString &n
// Update NickInfo.
// Update NickInfo.
ChannelNickPtr channelNick = addNickToJoinedChannelsList ( channelName , nickname ) ;
ChannelNickPtr channelNick = addNickToJoinedChannelsList ( channelName , nickname ) ;
NickInfoPtr nickInfo = channelNick - > getNickInfo ( ) ;
NickInfoPtr nickInfo = channelNick - > getNickInfo ( ) ;
if ( ( nickInfo - > getHost tq mask( ) ! = host tq mask) & & ! host tq mask. isEmpty ( ) )
if ( ( nickInfo - > getHost mask( ) ! = host mask) & & ! host mask. isEmpty ( ) )
{
{
nickInfo - > setHost tq mask( host tq mask) ;
nickInfo - > setHost mask( host mask) ;
}
}
outChannel - > joinNickname ( channelNick ) ;
outChannel - > joinNickname ( channelNick ) ;
}
}
@ -2566,15 +2566,15 @@ Channel* Server::nickJoinsChannel(const TQString &channelName, const TQString &n
return outChannel ;
return outChannel ;
}
}
void Server : : addHostmaskToNick ( const TQString & sourceNick , const TQString & sourceHost tq mask)
void Server : : addHostmaskToNick ( const TQString & sourceNick , const TQString & sourceHost mask)
{
{
// Update NickInfo.
// Update NickInfo.
NickInfoPtr nickInfo = getNickInfo ( sourceNick ) ;
NickInfoPtr nickInfo = getNickInfo ( sourceNick ) ;
if ( nickInfo )
if ( nickInfo )
{
{
if ( ( nickInfo - > getHost tq mask( ) ! = sourceHost tq mask) & & ! sourceHost tq mask. isEmpty ( ) )
if ( ( nickInfo - > getHost mask( ) ! = sourceHost mask) & & ! sourceHost mask. isEmpty ( ) )
{
{
nickInfo - > setHost tq mask( sourceHost tq mask) ;
nickInfo - > setHost mask( sourceHost mask) ;
}
}
}
}
}
}
@ -2683,14 +2683,14 @@ void Server::renameNick(const TQString &nickname, const TQString &newNick)
}
}
void Server : : userhost ( const TQString & nick , const TQString & host tq mask, bool away , bool /* ircOp */ )
void Server : : userhost ( const TQString & nick , const TQString & host mask, bool away , bool /* ircOp */ )
{
{
addHostmaskToNick ( nick , host tq mask) ;
addHostmaskToNick ( nick , host mask) ;
// remember my IP for DCC things
// remember my IP for DCC things
// myself
// myself
if ( m_ownIpByUserhost . isEmpty ( ) & & nick = = getNickname ( ) )
if ( m_ownIpByUserhost . isEmpty ( ) & & nick = = getNickname ( ) )
{
{
TQString myhost = host tq mask. section ( ' @ ' , 1 ) ;
TQString myhost = host mask. section ( ' @ ' , 1 ) ;
// Use async lookup else you will be blocking GUI badly
// Use async lookup else you will be blocking GUI badly
KNetwork : : KResolver : : resolveAsync ( this , TQT_SLOT ( gotOwnResolvedHostByUserhost ( KResolverResults ) ) , myhost , " 0 " ) ;
KNetwork : : KResolver : : resolveAsync ( this , TQT_SLOT ( gotOwnResolvedHostByUserhost ( KResolverResults ) ) , myhost , " 0 " ) ;
}
}
@ -3296,7 +3296,7 @@ void Server::removeBan(const TQString &channel, const TQString &ban)
void Server : : sendPing ( )
void Server : : sendPing ( )
{
{
//WHO ourselves once a minute in case the irc server has changed our
//WHO ourselves once a minute in case the irc server has changed our
//host tq mask, such as what happens when a Freenode cloak is activated.
//host mask, such as what happens when a Freenode cloak is activated.
//It might be more intelligent to only do this when there is text
//It might be more intelligent to only do this when there is text
//in the inputbox. Kinda changes this into a "do minutely"
//in the inputbox. Kinda changes this into a "do minutely"
//queue :-)
//queue :-)