[Konversation-devel] [Bug 255543] Konversation error open a bookmark
Eike Hein
hein at kde.org
Fri Oct 29 20:19:34 CEST 2010
https://bugs.kde.org/show_bug.cgi?id=255543
Eike Hein <hein at kde.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #4 from Eike Hein <hein kde org> 2010-10-29 20:19:33 ---
commit 884b34730db945fe1fd337c0db5ed2383f3a358f
branch master
Author: Eike Hein <hein at kde.org>
Date: Fri Oct 29 20:20:02 2010 +0200
Bookmark URL generation improvements.
Check whether QUrl accepts the network name as a hostname before
using it, otherwise we get into trouble in the KDE bookmarking
code. Fall back to the server hostname if we have to. Fixes book-
marking when the network name e.g. contains a space.
BUG:255543
Also excise the leading # in standard channel names - we handle
both cases fine, but it's implicit in the IRC url "standard".
diff --git a/src/viewer/chatwindow.cpp b/src/viewer/chatwindow.cpp
index 4133004..6637719 100644
--- a/src/viewer/chatwindow.cpp
+++ b/src/viewer/chatwindow.cpp
@@ -109,13 +109,30 @@ QString ChatWindow::getURI(bool passNetwork)
QString server;
QString channel;
+ if (getServer()->getUseSSL())
+ protocol = "ircs://";
+ else
+ protocol = "irc://";
if (getType() == Channel)
- channel = getName();
+ channel = getName().replace(QRegExp("^#"), QString());
if (passNetwork)
+ {
server = getServer()->getDisplayName();
- else
+
+ QUrl test(protocol+server);
+
+ // QUrl (ultimately used by the bookmark system, which is the
+ // primary consumer here) doesn't like spaces in hostnames as
+ // well as other things which are possible in user-chosen net-
+ // work names, so let's fall back to the hostname if we can't
+ // get the network name by it.
+ if (!test.isValid())
+ passNetwork = false;
+ }
+
+ if (!passNetwork)
{
server = getServer()->getServerName();
port = ':'+QString::number(getServer()->getPort());
@@ -124,11 +141,6 @@ QString ChatWindow::getURI(bool passNetwork)
if (server.contains(':')) // IPv6
server = '['+server+']';
- if (getServer()->getUseSSL())
- protocol = "ircs://";
- else
- protocol = "irc://";
-
url = protocol+server+port+'/'+channel;
return url;
--
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