Bug 246321 - JOIN sent during autojoin has useless channel keys
Summary: JOIN sent during autojoin has useless channel keys
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: protocol (show other bugs)
Version: Git
Platform: Compiled Sources Linux
: NOR minor
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-31 02:36 UTC by Nicolás Alvarez
Modified: 2011-03-06 07:28 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 Nicolás Alvarez 2010-07-31 02:36:21 UTC
When Konversation connects to a server and auto-joins channels, it sends a command like:

JOIN #konvi-test,#konvi-test2,#konvi-test3 .,.,.

The ".,.,." at the end are channel keys. "." means "no key"; but none of the channels here has a key, so that whole argument is unnecessary.

<Sho_> imagine you want to join channels #a, #b and #c
<Sho_> of these, only #c needs a key to join it
<Sho_> in that case the client is supposed to send #a,#b,#b .,.,key
<Sho_> iow, . is the placeholder for "no key"
<Sho_> however, trailing dot segments aren't needed and shouldn't be composed

I'm using Konversation from git, revision bb9a0fca (plus some personal patches).
Comment 1 Eike Hein 2010-07-31 19:24:12 UTC
I should add that while it behaving this way isn't pretty, it's also harmless - the code makes sure that no auto-join command is sent that exceeds the maximum buffer length instead (it produces multiple messages as necessary), so the wasted characters aren't fatal. Changing this code so it doesn't emit trailing ",." segments will complicate it considerably for relatively little gain.
Comment 2 Eike Hein 2010-07-31 19:35:31 UTC
commit 978fd7b94d09c674ef76387bdc3ac34822bf4a96
Author: Eike Hein <hein@kde.org>
Date:   Sat Jul 31 19:34:59 2010 +0200

    Pop off trailing placeholder segments in the last auto-join command.
    
    BUG:246321

diff --git a/ChangeLog b/ChangeLog
index bd8fd86..f3edf35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,10 @@ Changes since 1.3.1:
 * Fixed a bug causing the chat text notification messages originating in
   the Watched Nicknames Online system to be logged in HTML format (and
   thus HTML source to be displayed e.g. in backlog replay).
+* Fixed a (harmless) bug causing unnecessary trailing "." placeholder channel
+  key segments to be added to the raw format auto-join command (or to the
+  last of multiple such auto-join commands when the amount of auto-join
+  channels requires multiple commands to be generated).
 
 
 Changes from 1.3 to 1.3.1:
diff --git a/src/irc/server.cpp b/src/irc/server.cpp
index bc92da2..b87fd78 100644
--- a/src/irc/server.cpp
+++ b/src/irc/server.cpp
@@ -3597,6 +3597,8 @@ QStringList Server::generateJoinCommand(const Konversation::ChannelList &tmpList
         passwords << password;
     }
 
+    while (!passwords.isEmpty() && passwords.last() == ".") passwords.pop_back();
+
     joinCommands << "JOIN " + channels.join(",") + ' ' + passwords.join(",");
 
     return joinCommands;