Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Cool Fire
hexchat
Commits
59f32ccb
Commit
59f32ccb
authored
Oct 07, 2012
by
Berke Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix URL detection
parent
b4e78e04
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
5 deletions
+20
-5
src/common/url.c
src/common/url.c
+10
-0
src/common/url.h
src/common/url.h
+2
-0
src/fe-gtk/fe-gtk.c
src/fe-gtk/fe-gtk.c
+7
-5
src/fe-gtk/maingui.c
src/fe-gtk/maingui.c
+1
-0
No files found.
src/common/url.c
View file @
59f32ccb
...
...
@@ -202,6 +202,16 @@ url_check_word (char *word, int len)
const
char
*
at
,
*
dot
;
int
i
,
dots
;
/* this is pretty much the same as in logmask_is_fullpath() except with length checks */
#ifdef WIN32
if
((
len
>
1
&&
word
[
0
]
==
'\\'
)
||
(
len
>
2
&&
(((
word
[
0
]
>=
'A'
&&
word
[
0
]
<=
'Z'
)
||
(
word
[
0
]
>=
'a'
&&
word
[
0
]
<=
'z'
))
&&
word
[
1
]
==
':'
)))
#else
if
(
len
>
1
&&
word
[
0
]
!=
'/'
)
#endif
{
return
WORD_PATH
;
}
if
(
len
>
1
&&
word
[
1
]
==
'#'
&&
strchr
(
"@+^%*#"
,
word
[
0
]))
return
WORD_CHANNEL
;
...
...
src/common/url.h
View file @
59f32ccb
...
...
@@ -8,7 +8,9 @@ extern void *url_tree;
#define WORD_CHANNEL 3
#define WORD_HOST 4
#define WORD_EMAIL 5
/* anything >0 will be displayed as a link by gtk_xtext_motion_notify() */
#define WORD_DIALOG -1
#define WORD_PATH -2
void
url_clear
(
void
);
void
url_save
(
const
char
*
fname
,
const
char
*
mode
,
gboolean
fullpath
);
...
...
src/fe-gtk/fe-gtk.c
View file @
59f32ccb
...
...
@@ -1080,16 +1080,18 @@ fe_open_url_inner (const char *url)
static
void
fe_open_url_locale
(
const
char
*
url
)
{
#ifndef WIN32
if
(
url
[
0
]
!=
'/'
&&
strchr
(
url
,
':'
)
==
NULL
)
/* the http:// part's missing, prepend it, otherwise it won't always work */
if
(
strchr
(
url
,
':'
)
==
NULL
)
{
url
=
g_strdup_printf
(
"http://%s"
,
url
);
fe_open_url_inner
(
url
);
g_free
((
char
*
)
url
);
return
;
}
#endif
fe_open_url_inner
(
url
);
/* we have a sane URL, send it to the browser untouched */
else
{
fe_open_url_inner
(
url
);
}
}
void
...
...
src/fe-gtk/maingui.c
View file @
59f32ccb
...
...
@@ -2291,6 +2291,7 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even)
switch
(
mg_word_check
(
xtext
,
word
,
strlen
(
word
)))
{
case
0
:
case
WORD_PATH
:
menu_middlemenu
(
sess
,
even
);
break
;
case
WORD_URL
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment