PDA

View Full Version : HOWTO: Open copy and open irc links into Xchat



gflores
April 10th, 2005, 05:22 AM
On some sites, like in ircspy, there are irc links that when you click on them, will copy the command and open it in the default irc client.
irc://irc.something.com/foo is a typical link and a typical command is /ctcp foobot xdcc send #1

A few changes need to be done in Firefox in order for this function properly.
I assume you are using Firefox as your web browser and Xchat as your IRC client.

To make Firefox copy the irc links (like from ircspy)
Open up Firefox.
Type about:config in Firefox location bar.
Then, in the filter box, type signed.applets
Double click the entry that appears so that it reverts to true.

Make the links open up in Xchat
Next, in the about:config window, right click on an area there, and select New -> String
In the preference name dialog that pops up, type in network.protocol-handler.app.irc
Then for the string value, type in /usr/bin/xchat

You don't have to restart Firefox. Now go to a site and click on an irc link and a dialog will appear saying if it's ok for the link to launch xchat. Just select ok.

Hope that helps.
El Fin.

Sionide
May 24th, 2005, 10:47 PM
Useful, always found it handy that mIRC supported the irc:// protocol. Did you know if you make an irc:// link in a wiki it makes a little chat icon appear instead of a normal link. Same with mailto: links but it's a little email symbol. Quality

nomad311
July 24th, 2005, 06:41 PM
hmmm it works ...but not very well

is it possible to have it open in the same xchat?

but useful all the same!

thnx
-nomad311

zeroverse
October 12th, 2005, 04:14 AM
Very useful indeed. Would also like it to open in a new tab in the same xchat if possible. Thanks

zandrame
May 31st, 2007, 08:30 AM
Can this also be done with firefox/konversation? Setting "network.protocol-handler.external.irc = true" and "network.protocol-handler.app.irc = /usr/bin/konversation" does not work.

If you know how to make it work, thanks!

Morientes
June 27th, 2007, 07:13 PM
I cant get it to work. xchat launches, but it does not connect to the irc server. Any ideas what I am doing wrong?

roderic
June 30th, 2007, 12:46 AM
I had the same problem, only solution that i saw was making a little script to open the irc chanell in an existing xchat, and pass that to firefox. Just make a file in /usr/bin called xchat-firefox and put in it:


#!/bin/bash
xchat --existing --url=$@

and chmod +x the file. Now in about:config put /usr/bin/xchat-firefox in network.protocol-handler.app.irc. I hope that helps.

Morientes
July 3rd, 2007, 09:36 AM
..and that worked perfectly! Thanks a lot!

Do have an idea of a script that would do something similar but in konversation instead?

By the way, it seems that if I connect to some networks using xchat, the networks ban me and say that "it seems you have a mirc virus" ? Does anyone know what that means?

Morientes
July 3rd, 2007, 05:11 PM
I have made a script that works partially with konversation. It works if konversation is not started. But if it is already running, it does not work. Does anyone know what could be changed to make it work also when it's running. The script can be seen below.


#!/bin/bash

#Storing the input string
input_string=$@

#Removing /channel-name
network_filter1=${input_string%/*}

#Removing irc://
network=${network_filter1#*//}

#Removing irc://network-name/
channel=${input_string#*//*/}

#Starting konversation with the network and channel name
konversation --server=$network --channel=#$channel

taisao
August 31st, 2007, 02:22 PM
it's late, but here is a solution

use:

/usr/bin/konversationircprotocolhandler

instead of:

/usr/bin/konversation

iDelimar
November 22nd, 2007, 05:31 PM
I'm wondering what the solution is to the problem beneath because I'm having it too. Firefox launches Xchat but doesn't connect with the server.


I cant get it to work. xchat launches, but it does not connect to the irc server. Any ideas what I am doing wrong?

Grtz M.

johnnylavah
February 23rd, 2008, 07:16 PM
I'm wondering what the solution is to the problem beneath because I'm having it too. Firefox launches Xchat but doesn't connect with the server.

Grtz M.

seems to work fine for me....still looking for a xdcc browser though...

sagara
March 9th, 2008, 10:03 PM
I'm wondering what the solution is to the problem beneath because I'm having it too. Firefox launches Xchat but doesn't connect with the server.



Grtz M.

iDelimar, I had the same problem as you. Based on the suggestion given on roderic's post (#7 (http://ubuntuforums.org/showpost.php?p=2937198&postcount=7)) I did the following:

Create a scripts directory in your home folder:

mkdir scripts
Create the script that will launch xchat

gedit irc.bash
Inside gedit paste the following code:

#!/bin/bash
# wrapper script for launching xchat from firefox (patch)


/usr/bin/xchat-gnome --existing --url=$@
The command that I highlited in red might be different. If it is not xchat-gnome it will be xchat.
Give the script executable permissions

chmod u+x irc.bash
In firefox about:config page, I set the option network.protocol-handler.app.irc to /home/YOUR_USERNAME/scripts/irc.bash

With this xchat opens and connects to the corresponding server/channel. I'm a bit dissapointed that all this manual work is required to get this to work...

Miroku
June 13th, 2008, 11:52 PM
thx sagara! i would thank you but there is no thank you button. makes gettin new anime that much easier. thx alot.

paniwani
May 25th, 2009, 07:20 AM
I still can't get it to work. After clicking the packet number on packetnews.com the trigger is on my clipboard but xchat does not start...

Daeluin
June 13th, 2009, 03:43 PM
I'm having the same problem - created the script and tested it with ./script irc://irc-url and it opens in an existing xchat intance as expected. awesome.

but firefox does nothing when I click on a irc url. I can set the prefs-apps irc handler to always ask, and then whenever I click it asks if I'd like to open with my script, and I say yes. So I imagine firefox is running the script, or trying to... is there something in jaunty that would prevent firefox from running the script? apparmor? I've looked around but who knows... script is executable and all that.

Edit: ok, ran firefox from the command line and when I clicked on the irc link it basically yelled at me that pidgin wasn't running.... so I was able to find that gnome wanted to do it's own thing with this link, and running gconf-editor and browsing to desktop/gnome/url-handlers irc let me change that. sheesh.

sagara
June 21st, 2009, 03:48 AM
I'm having the same problem - created the script and tested it with ./script irc://irc-url and it opens in an existing xchat intance as expected. awesome.

but firefox does nothing when I click on a irc url. I can set the prefs-apps irc handler to always ask, and then whenever I click it asks if I'd like to open with my script, and I say yes. So I imagine firefox is running the script, or trying to... is there something in jaunty that would prevent firefox from running the script? apparmor? I've looked around but who knows... script is executable and all that.

Edit: ok, ran firefox from the command line and when I clicked on the irc link it basically yelled at me that pidgin wasn't running.... so I was able to find that gnome wanted to do it's own thing with this link, and running gconf-editor and browsing to desktop/gnome/url-handlers irc let me change that. sheesh.

hey Daeluin, I currently upgraded to Jaunty with a fresh install. I will let you know how I do once I try to apply this script with firefox.

printfw
September 8th, 2010, 07:07 PM
Bump this thread. Maybe someone knows how to open irc links into xchat from Google Chrome / Chromium?

UPD: I found out that chromium calls xdg-open for irc links. So the question is how to configure MIME type for irc links.

volkerbradley
November 19th, 2010, 03:04 PM
Bump this thread. Maybe someone knows how to open irc links into xchat from Google Chrome / Chromium?

UPD: I found out that chromium calls xdg-open for irc links. So the question is how to configure MIME type for irc links.
Here is how I did this:
Wrote another mime type, by going to /home/username/.local/share/mime/packages and created an irc.xml file
Into this file I put:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/irc">
<comment>irc url</comment>
<magic priority="50">
<match value="%irc://-" type="string" offset="0"/>
</magic>
<alias type="application/x-chat"/>
</mime-type>
</mime-info>

Then I ran update-mime-database ~/.local/share/mime/ to update the database
then I added the following line:
Mime type=application/x-chat
to the /usr/share/app-install/desktop/xchat.desktop and /usr/share/applications/xchat.desktop files

Then:
mkdir ~/scripts
cd scripts
vi irc.bash
Put the following into this file:
#!/bin/bash
# wrapper script for launching xchat and the desired channel from Chrome
/usr/bin/xchat --existing --url=$@

Saved the file and then did chmod u+x irc.bash
Then, clicked on Applications -> System Tools -> Configuration Editor -> desktop -> gnome -> url-handlers -> irc
edited the "command" key and changed it to /home/username/scripts/irc.bash
Now clicking on the irc://... url in Chrome opens xchat with the desired channel

If someone knows how to get Chrome pass the command to glipper, I sure would appreciate it.

vinman_sv
January 28th, 2011, 05:33 PM
This worked for me and I've tried everything on this post WORKING UBUNTU 10.10 (SOLVED)

read this post


http://linux.byexamples.com/archives/318/how-to-trigger-xchat-from-firefox/#comment-100027

volkerbradley
April 23rd, 2011, 07:52 AM
This works very well with Firefox.
Thanks for the tip.
Anyone figure how to do this with Google Chrome?