Bug 133240 - expando nick variable for use in server commands (e.g., "/mode %n +x")
Summary: expando nick variable for use in server commands (e.g., "/mode %n +x")
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-30 04:22 UTC by Languid Heap
Modified: 2006-08-30 15:49 UTC (History)
0 users

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 Languid Heap 2006-08-30 04:22:32 UTC
Version:           0.19 #3100 (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages

I am requesting some sort of variable that would expand the user's current nick, for use in the Commands box in the Edit Network dialog.

On some IRC servers, they use a channel mode that allows for the masking of a user's IP -- http://www.gamesurge.net/userchanmodes/

I've just switched over from x-chat where, on server join, I'd automatically execute "/mode %n +x" which would apply the hide mask/ip. In x-chat %n is an "expando" for current nick. 

Would something like this be possible for Konversation?

Thanks,
Languid
Comment 1 Eike Hein 2006-08-30 15:49:40 UTC
SVN commit 578875 by hein:

* Support %nick as a placeholder for the current nick in
  the auto-connect commands.
BUG:133240
* Don't balk on leading whitespace in the auto-connect
  commands. I assume I'm not the only one who by reflex
  puts a space after the separating ";".


 M  +2 -0      ChangeLog  
 M  +1 -1      src/commit.h  
 M  +7 -2      src/server.cpp  


--- trunk/extragear/network/konversation/ChangeLog #578874:578875
@@ -185,6 +185,8 @@
 * If given no parameter, the "/away" command will now set the away state with
   the default away message. The "/back" and "/unaway" commands can be used to
   unset the away state.
+* You may now use "%nick" as a placeholder for your own nickname in the auto-
+  connect commands for a network.
 * A bug that could lead to the auto-connect commands for a network not being
   executed correctly has been fixed.
 
--- trunk/extragear/network/konversation/src/commit.h #578874:578875
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 3156
+#define COMMIT 3157
 #endif
--- trunk/extragear/network/konversation/src/server.cpp #578874:578875
@@ -961,13 +961,18 @@
 {
     if (!m_serverGroup->connectCommands().isEmpty())
     {
-        QStringList connectCommands = QStringList::split(";", m_serverGroup->connectCommands());
+        QString connectCommands = m_serverGroup->connectCommands();
 
+        if (!getNickname().isEmpty())
+            connectCommands.replace("%nick", getNickname());
+
+        QStringList connectCommandsList = QStringList::split(";", connectCommands);
         QStringList::iterator iter;
 
-        for(iter = connectCommands.begin(); iter != connectCommands.end(); ++iter)
+        for(iter = connectCommandsList.begin(); iter != connectCommandsList.end(); ++iter)
         {
             QString output(*iter);
+            output = output.simplifyWhiteSpace();
             Konversation::OutputFilterResult result = outputFilter->parse(getNickname(),output,QString::null);
             queue(result.toServer);
         }