diff --git a/js/websockets.js b/js/websockets.js
index 91e4ba4..40d1381 100644
--- a/js/websockets.js
+++ b/js/websockets.js
@@ -149,11 +149,10 @@ weechat.factory('youtubePlugin', [function() {
weechat.factory('urlPlugin', [function() {
var contentForMessage = function(message) {
- var prefix = 'http://';
- var linkIndex = message.indexOf(prefix);
- if (linkIndex != -1) {
- var token = message.substr(linkIndex);
- return '' + token + '';
+ var urlPattern = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/;
+ var url = message.match(urlPattern);
+ if (url) {
+ return '' + message + '';
}
return null;
}