[Konversation-devel] [Bug 246352] konversation from the command line does not recognize ircs:// URIs

Eike Hein hein at kde.org
Sat Jul 31 20:07:21 CEST 2010


https://bugs.kde.org/show_bug.cgi?id=246352


Eike Hein <hein at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Eike Hein <hein kde org>  2010-07-31 20:07:19 ---

    A     data/konvircs.protocol     [License: Trivialfile.]

commit 784db8012290950f8d1f97b7b0f5fa2c6942166a
Author: Eike Hein <hein at kde.org>
Date:   Sat Jul 31 20:06:41 2010 +0200

    Add support for ircs:// URLs.

    BUG:246352

diff --git a/ChangeLog b/ChangeLog
index f3edf35..b2487c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,11 @@ Changes since 1.3.1:
   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).
+* Added support for ircs:// URLs, the 's' standing for 'SSL'. It is supported
+  both for opening and for bookmarking. If an ircs:// URL matches a server
+  configured in the server list or refers to a network name instead of a
+  specific server, the directive from the URL overrides the state of the SSL
+  setting in the configuration.


 Changes from 1.3 to 1.3.1:
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index f8eb508..1c25acf 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -19,4 +19,4 @@ install(PROGRAMS updaters/konversation-0.19-colors.pl
                 updaters/konversation-0.20-quickbuttons.pl
                 updaters/konversation-0.20-customfonts.pl
                 DESTINATION ${DATA_INSTALL_DIR}/kconf_update)
-install(FILES  konvirc.protocol konvirc6.protocol DESTINATION
${SERVICES_INSTALL_DIR})
+install(FILES  konvirc.protocol konvircs.protocol konvirc6.protocol
DESTINATION ${SERVICES_INSTALL_DIR})
diff --git a/data/konvircs.protocol b/data/konvircs.protocol
new file mode 100644
index 0000000..8118795
--- /dev/null
+++ b/data/konvircs.protocol
@@ -0,0 +1,11 @@
+[Protocol]
+exec=konversation %u
+protocol=ircs
+input=none
+output=none
+helper=true
+listing=false
+reading=false
+writing=false
+makedir=false
+deleting=false
diff --git a/src/commit.h b/src/commit.h
index d239825..0a9da5c 100644
--- a/src/commit.h
+++ b/src/commit.h
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 4064
+#define COMMIT 4065
 #endif
diff --git a/src/common.cpp b/src/common.cpp
index ad534aa..160019d 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -27,7 +27,7 @@ namespace Konversation
 {

     static QRegExp
colorRegExp("((\003([0-9]|0[0-9]|1[0-5])(,([0-9]|0[0-9]|1[0-5])|)|\017)|\x02|\x09|\x13|\x16|\x1f)");
-    static QRegExp
urlPattern("((www\\.(?!\\.)|(fish|irc|amarok|(f|sf|ht)tp(|s))://)(\\.?[\\d\\w/,\\':~\\?=;#@\\-\\+\\%\\*\\{\\}\\!\\(\\)\\[\\]\\^]|&)+)|"
+    static QRegExp
urlPattern("((www\\.(?!\\.)|(fish|irc|ircs|amarok|(f|sf|ht)tp(|s))://)(\\.?[\\d\\w/,\\':~\\?=;#@\\-\\+\\%\\*\\{\\}\\!\\(\\)\\[\\]\\^]|&)+)|"
         "([-.\\d\\w]+@[-.\\d\\w]{2,}\\.[\\w]{2,})");

     void initChanModesHash()
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 185f565..e34d38d 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -44,7 +44,7 @@ void
ConnectionManager::connectTo(Konversation::ConnectionFlag flag, const QStri
 {
     ConnectionSettings settings;

-    if (target.startsWith(QLatin1String("irc://")))
+    if (target.startsWith(QLatin1String("irc://")) ||
target.startsWith(QLatin1String("ircs://")))
         decodeIrcUrl(target, settings);
     else
     {
@@ -303,11 +303,11 @@ void ConnectionManager::reconnectServers()

 void ConnectionManager::decodeIrcUrl(const QString& url, ConnectionSettings&
settings)
 {
-    if (!url.startsWith(QLatin1String("irc://"))) return;
+    if (!url.startsWith(QLatin1String("irc://")) &&
!url.startsWith(QLatin1String("ircs://"))) return;

     QString mangledUrl = url;

-    mangledUrl.remove(QRegExp("^irc:/+"));
+    mangledUrl.remove(QRegExp("^ircs?:/+"));

     if (mangledUrl.isEmpty()) return;

@@ -386,6 +386,16 @@ void ConnectionManager::decodeIrcUrl(const QString& url,
ConnectionSettings& set

         settings.setOneShotChannelList(cl);
     }
+
+    // Override SSL setting state with directive from URL.
+    if (url.startsWith(QLatin1String("ircs://")))
+    {
+        Konversation::ServerSettings server = settings.server();
+
+        server.setSSLEnabled(true);
+
+        settings.setServer(server);
+    }
 }

 void ConnectionManager::decodeAddress(const QString& address,
ConnectionSettings& settings,
diff --git a/src/irc/nicklistview.cpp b/src/irc/nicklistview.cpp
index 409ccc4..173d2e9 100644
--- a/src/irc/nicklistview.cpp
+++ b/src/irc/nicklistview.cpp
@@ -494,8 +494,12 @@ bool NickListView::canDecodeMime(QDropEvent const *event)
const {
         {
             const KUrl first = uris.first();

-            if ((first.protocol() == QLatin1String("irc")) ||
channel->getNickList().containsNick(first.url()))
-                return false;
+            if (first.protocol() == QLatin1String("irc") ||
+                first.protocol() == QLatin1String("ircs") ||
+                channel->getNickList().containsNick(first.url()))
+                {
+                    return false;
+                }
         }
         return true;
     }
diff --git a/src/viewer/chatwindow.cpp b/src/viewer/chatwindow.cpp
index 72149c5..785cc9e 100644
--- a/src/viewer/chatwindow.cpp
+++ b/src/viewer/chatwindow.cpp
@@ -103,6 +103,7 @@ QString ChatWindow::getTitle()

 QString ChatWindow::getURI(bool passNetwork)
 {
+    QString protocol;
     QString url;
     QString port;
     QString server;
@@ -123,7 +124,12 @@ QString ChatWindow::getURI(bool passNetwork)
     if (server.contains(':')) // IPv6
         server = '['+server+']';

-    url = "irc://"+server+port+'/'+channel;
+    if (getServer()->getUseSSL())
+        protocol = "ircs://";
+    else
+        protocol = "irc://";
+
+    url = protocol+server+port+'/'+channel;

     return url;
 }
diff --git a/src/viewer/ircview.cpp b/src/viewer/ircview.cpp
index 33e0007..12a6f33 100644
--- a/src/viewer/ircview.cpp
+++ b/src/viewer/ircview.cpp
@@ -1508,7 +1508,7 @@ void IRCView::openLink(const QUrl& url)

     if (!link.isEmpty() && !link.startsWith('#'))
     {
-        if (link.startsWith(QLatin1String("irc://")))
+        if (link.startsWith(QLatin1String("irc://")) ||
link.startsWith(QLatin1String("ircs://")))
         {
             Application* konvApp = Application::instance();
            
konvApp->getConnectionManager()->connectTo(Konversation::SilentlyReuseConnection,
link);
diff --git a/src/viewer/topiclabel.cpp b/src/viewer/topiclabel.cpp
index 5f86d98..5dc333b 100644
--- a/src/viewer/topiclabel.cpp
+++ b/src/viewer/topiclabel.cpp
@@ -87,7 +87,7 @@ namespace Konversation
     {
         if (!link.isEmpty())
         {
-            if (link.startsWith(QLatin1String("irc://")))
+            if (link.startsWith(QLatin1String("irc://")) ||
link.startsWith(QLatin1String("ircs://")))
             {
                 Application* konvApp = static_cast<Application*>(kapp);
                
konvApp->getConnectionManager()->connectTo(Konversation::SilentlyReuseConnection,
link);

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Konversation-devel mailing list