Pidgin and X-chat plugins to execute a command on new messages February 14, 2010
Posted by GuySoft in Crictor, Hamakor, ITU, linux, open source, programming, python.Tags: open source, pidgin, programming, python, source code, x-chat
trackback
A while ago, when I coded message alert plugins for pidgin and X-chat so each time I get a new message my bumble-b LED display would flash, so I thought I might release the code here for people to use.
Both plugins will execute a command of your choice when receiving a new message.
Thanks to Simo Mattila who wrote the base code for the pidgin plugin 🙂
- Source code for the pidgin plugin
- You will have to follow the README file and compile the plugin. Then place the created .so file in ~/.purple/plugins/ .
- In the plugin menu there would be a configuration window to set the command.
- Source code for the X-chat plugin
- You will have to set the command inside the python file. Then copy it to ~/.xchat2/
- The X-chat plugin also is able to return the name of the user that sent the message.
Here is a video of the X-chat plugin in action:
I hope to find more time to posts the things I am doing, but as usual, university takes up all my time. Stay tuned
Why are you linking to your home box if it isn’t stable and consistent?
Well I host it there because its comfortable, stable past 10 years.
About the insatiability you had yesterday, sorry about that, I did a server upgrade that went bad (apparently there is a dependency problem in Debian that breaks PHP5 when installing mumble-server).
I get:
Traceback (most recent call last):
File “/home/brian/.xchat2/newmassage_notify.py”, line 5, in
command_arguments=[command,”xchat”,topic]
NameError: name ‘topic’ is not defined
Error loading module /home/brian/.xchat2/newmassage_notify.py
Oh my, you are right!
I moved that line up for easy reading, not seeing it breaks the code!
Fixed, but there should be a way to make the configuring more firendly
That is in a file “/home/guy/stuff/scripts/matrix.py”?
I set command to “/usr/bin/notify-send” and has a received error:
====
Traceback (most recent call last):
File “/home/xopek/.xchat2/newmassage_notify.py”, line 31, in print_channel_msg_hilight_cb
notify(word[0], word[1], “critical”)
File “/home/xopek/.xchat2/newmassage_notify.py”, line 19, in notify
p = Popen(command_arguments)
File “/usr/lib/python2.6/subprocess.py”, line 621, in __init__
errread, errwrite)
File “/usr/lib/python2.6/subprocess.py”, line 1126, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
===
What a file not found?
===
$ which notify-send
/usr/bin/notify-send
===
What to do? 🙂
Sorry, has forgotten a say.
On CTCP action scripts is worked and notify showing but no error 🙂
might you be able to see what
print command_arguments
gives you?
If the file is there it should run.
the command-notification.so = command-notification.py ??
is posible return messages for the client?
who see the result of command?
thanks ..
1. There is only command-notification.so , the plugin is written in C, not python (the X-chat plugin is in python).
2. No, you can use autoreply plugin for that.
3. You are exacting a command on the machine running pidgin. Who ever sees it Depends what the commend does.
Hi ! Great plugin (I’m using the pidgin one), I’m actually surprised nobody coded this before, it’s really handy.
I would like to use your plugin as a mean to make my numlock LED blink when I have an unread message in pidgin. I’m using blinkd daemon and have binded a blink command using your plugin. The problem is that the LED keeps blinking even after I’ve read the message, since I cannot send another command to tell it to stop.
Would it be possible to modify the plugin so that another command can be executed when all messages have been read ? I’ve looked at your C code, but I’m not familiar with purple plugins, and I’m afraid I did not understand much…
Sure, go ahead 🙂
Also I might point out that my plugin is based off one that was used to blink laptop’s LEDs, but I can already tell you that its not the same commands for the numlock. I suggest you look at Ledcontrol (also available in package repositories), You might be able to get it to run without editing the plugin’s source.
Thanks, I already tried the ledcontrol plugin, with no luck. It does not seem to like my hardware. Besides, a modification of your plugin would be far more generic than ledcontrol.
I’ll try my luck messing with your code. If you have any pointers on what to modify/add, I’d appreciate the help.
Well, I managed to sort it out, I think. I’ve sent you a mail, maybe you could publish the new version of the plugin here ?
[…] précolombienne : n’hésitez pas à me remonter des bugs, ou à les poster directement chez Guy Sheffer, qui gère le […]
Thanks for this awesome plugin.
I was wondering if it’s it possible for the plugin to pass the new conversation to the notification command?
Yes you can do that. But there is a plugin for that already, so there is its kinda pointless.
Nice function – is there any way to have the command access the sender and message text?
I am afraid not.
I am getting quite a few feature requests, seems to me there is call for a full blown advanced plugin for this.. I wish I had time for that.
hi, why it doesnt work with finch? 😦
What is Finch?
the console version of pidgin.
i’m just writing an own plugin which can be used by finch and pidgin.
Strange, if it loads the pidgin framework it should work.
No, because you are using gtk for the ui.
Peter, if you figure out how to pass the sender and message text to the external command, that’d be awesome.
How do you build the DLL for the windows version of pidgin?
I am not sure how, I only have linux machines here.
It should be possible.
Stumbled upon this and it was nearly what I needed: I added the option to execute a different command on having seen every unseen message: https://gist.github.com/jonasc/65912c935eb374f35850
The code for the plugin can now be found at github:
https://github.com/jonasc/command-notification