Bug 72391 - program does not allow irc channels that start with a '+'
Summary: program does not allow irc channels that start with a '+'
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: IRC Plugin (show other bugs)
Version: 0.7.3
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 72412 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-11 13:36 UTC by Sven Bothe
Modified: 2004-01-27 04:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Bothe 2004-01-11 13:36:34 UTC
Version:           0.7.3 (using KDE 3.1.4)
Installed from:    SuSE
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:          Linux (i686) release 2.4.21-166-athlon

The program falsely claims that there were no channels starting with '+', but that all channels must start with '#', and refuses to connect to the given '+' channel, e.g. "+bonn".
Comment 1 Jason Keirstead 2004-01-11 18:23:03 UTC
Oh what network can channels start with a  +?
Comment 2 Jason Keirstead 2004-01-11 21:01:39 UTC
Subject: kdenetwork/kopete/protocols/irc

CVS commit by brunes: 

Accept channels with non # identifiers.

Note this is still not fully resolved since the strings are now wrong, and
I am not handling error code 403 when you try to join a chan type on a netowrk
that doesn't have them.

But at least now people can join these channel types.

CCMAIL:72391@bugs.kde.org


  M +8 -6      ircprotocol.cpp   1.141


--- kdenetwork/kopete/protocols/irc/ircprotocol.cpp  #1.140:1.141
@@ -39,4 +39,6 @@ typedef KGenericFactory<IRCProtocol> IRC
 K_EXPORT_COMPONENT_FACTORY( kopete_irc, IRCProtocolFactory( "kopete_irc" )  );
 
+static QRegExp isChannelRegex( QString::fromLatin1("^[#!+&][^\\s,:]+$") );
+
 IRCProtocol *IRCProtocol::s_protocol = 0L;
 
@@ -325,10 +327,10 @@ void IRCProtocol::slotJoinCommand( const
         if( !args.isEmpty() )
         {
-                QStringList argsList = KopeteCommandHandler::parseArguments( args );
-                if( argsList.front().startsWith( QString::fromLatin1("#") ) )
-                        static_cast<IRCAccount*>( manager->account() )->findChannel( argsList.front() )->startChat();
+                QString chan = KopeteCommandHandler::parseArguments( args ).front();
+                if( isChannelRegex.search( chan ) != -1 )
+                        static_cast<IRCAccount*>( manager->account() )->findChannel( chan )->startChat();
                 else
                 {
-                        KopeteMessage msg(manager->user(), manager->members(), i18n("\"%1\" is an invalid channel. Channels must start with '#'.").arg(argsList.front()), KopeteMessage::Internal, KopeteMessage::PlainText, KopeteMessage::Chat);
+                        KopeteMessage msg(manager->user(), manager->members(), i18n("\"%1\" is an invalid channel. Channels must start with '#'.").arg(chan), KopeteMessage::Internal, KopeteMessage::PlainText, KopeteMessage::Chat);
                         manager->appendMessage(msg);
                 }
@@ -370,5 +372,5 @@ void IRCProtocol::slotQueryCommand( cons
                 QString rest = args.section( ' ', 1 );
 
-                if( !user.startsWith( QString::fromLatin1("#") ) )
+                if( !isChannelRegex.search( user ) != -1 )
                 {
                         IRCUserContact *c = static_cast<IRCAccount*>( manager->account() )->findUser( user );
@@ -442,5 +444,5 @@ void IRCProtocol::slotKickCommand( const
                 KopeteContactPtrList members = manager->members();
                 QString channel = static_cast<IRCContact*>( members.first() )->nickName();
-                if( channel.startsWith( QString::fromLatin1("#")) )
+                if( isChannelRegex.search( channel ) != -1 )
                         static_cast<IRCAccount*>( manager->account() )->engine()->kickUser( nick, channel, reason );
         }


Comment 3 Thiago Macieira 2004-01-12 03:31:40 UTC
A couple of networks, but I think those modeless channels have fallen into disuse.

The three different prefix characters for channels are #, & and +. I know of no network using different types.

Anyways, some networks send the CHANTYPES capability during logon which list the available types.
Comment 4 Thiago Macieira 2004-01-12 03:34:36 UTC
*** Bug 72412 has been marked as a duplicate of this bug. ***
Comment 5 Jason Keirstead 2004-01-27 04:18:42 UTC
Strings updated in HEAD. closing.