Tagged: mcabber Toggle Comment Threads | Keyboard Shortcuts

  • Akarsh Simha 1:59 am on May 26, 2008 Permalink
    Tags: DBus, mcabber   

    MCabber DBus Glue / Filter patch 

    I decided to send out my unclean DBus / filter code for MCabber to the author as it is, because I knew I’d postpone cleaning it up ad infinitum, that too with the GSoC thread running with a rather low niceness value. So I’m putting the link up here as well. Do let me know if you make any improvements to this, so that I can use the new code as well ;-).

    You should find the tarball containing all changes [except that to the Makefile] to mcabber-0.9.5 here.

    Put the dbusglue.* and filter.* files into the src/ directory and edit the Makefile to include these. Apply the patch mcabber-patch [You may have to do it manually, because I didn’t take much care to do the diff correctly. In fact, I don’t know how to diff folder contents correctly, and any help towards this will be appreciated] and compile.

    You can find an ugly mcabber-remote written using DBus for this patched version of mcabber 0.9.5 here. I use a small script to set my current playing track (retrieved from polling mocp -i at appropriate intervals. Google: there’s a script by someone to do this for pidgin or some other client) as my Google Talk status periodically using the same mcabber-remote.

     
  • Akarsh Simha 2:56 pm on April 14, 2008 Permalink
    Tags: , mcabber   

    DBus for MCabber 

    I desperately wanted this, so I coded it over a night. Comment on this post if you want a tarball.

    Now I can set the mcabber status to the current playing track from mocp using a script. 😀

     
  • Akarsh Simha 12:13 am on April 12, 2008 Permalink
    Tags: , mcabber   

    Spam Filtering for Jabber? 

    I am frequently pained when Isomeone asks me a technical question on Jabber. I’d want to redirect them to the IRC channel #iitm-linux but I feel “obliged” to respond, and I hate to hide. So, I wanted some filtering, just like I have procmail for mail filtering, for Jabber chats as well – that way, I’ll be blissfully ignorant of unwanted messages.

    So I hacked the MCabber source to introduce a programmable filter that any messages are passed through, before they flash my bulb. The modified files in the src directory of the mcabber tarball on the MCabber site are available here temporarily.

    Just create an executable ~/.mcabber/filter and chmod it to atleast u+rx to get the filter working.

    The filter can accept four command line args – The JID of the sender, The resource of the sender, The Message, and The Type of Message (as defined by MCabber) and must output the processed message to stdout. If the filter outputs nothing, then no message is displayed.

    I’ve done something extremely dumb: I could’ve piped the message into stdin, instead of putting it as a command line argument. Most of my time went into trying to escape the quotes in the message, encountering lot of dumb bugs – I could’ve saved on that. Late realisation. 😦

    Anyway, will fix that in future. There are many more interesting things to left to do – like passing the current status into the filter, so that you can vary the action of the filter depending on whether you’re away, busy or available, and hacking MCabber to get DBus support and writing a MCabber Remote to create programmable autoresponders!

     
  • Akarsh Simha 1:48 am on March 22, 2008 Permalink
    Tags: ioctl, , mcabber,   

    Computer controlled tubelights! 

    A few months back, I implemented an interface using the Parallel Port to control my room’s tubelight and bulb. Such circuits that interface electrical devices to the computer through parallel port are extremely popular on the internet. My version uses one optocoupler (MCT2E), one transistor, a pair of resistors and a relay for every device I wish to control. So I’ve got some two implementations of this as of now.

    A simple C program can help control the bits on the parallel port (and thereby the devices). Again, there are examples all over the internet like this one, that help you do that. I wanted something more flexible and easy to use, so I wrote a rather long program (maybe it is an overkill). Forgive me for the unclean and dirty code. Here it is. You can kick me for writing dirty C++ – I hardly learnt any C++. (I learnt that it is dumb to use stdio.h, fprintf etc in C++ code, and that all C++ code must be encapsulated, but who cares! I wrote this for my own use, and am graciously releasing it, so take it if you must, and if you do write better and cleaner versions, please link them in the comments to this post! :-D). What this code does is to implement something that can toggle the state of a specified device.

    In this code, I read a configfile that defines the values of the bits that need to be switched on to control each of the devices. I implemented this so that it remains extensible – I’m planning to extend this to control my fan as well :-D. Once you’ve defined values in the configfile, you can then do things like:

    sudo lpdevctl bulb

    You can also specify a default device that’ll get toggled if you just say sudo lpdevctl (without an argument).

    Once you have such a program, you can do lots of interesting things. The simplest of them would be to switch on your tubelight after 10 seconds delay, say:

    sleep 10; sudo lpdevctl tubelight

    Something slightly more interesting:

    for i in `seq 1 5`; do sleep 0.5; sudo lpdevctl bulb; sleep 0.5; sudo lpdevctl bulb; done;

    That flashes the lamp 5 times. Even more interesting – switching on your tubelight every day automatically at 1830 hours is like setting up a cronjob at 1830 hours to execute sudo lpdevctl tubelight.

    I use a Jabber client called mcabber which has external action triggers, that can call an external action when something happens. So if somebody pings me on IM, I am notified of it through the flashing of my bulb (which I seldom use otherwise) instead of some ding sound that interrupts the beautiful music I’m playing. Besides, this alert is easy to switch off – because I can go and turn off the light bulb switch – and the relay is in series with that!

    Once you get a command on your Linux system to do something, the ways in which you can extend it are infinite and are only (un)bounded by your creativity!

    I like the idea of switching on my room light while sitting in my department computing facility using SSH 😀

     
    • Prasanna 10:10 pm on March 22, 2008 Permalink | Log in to Reply

      That was really a nice idea.

      @Other readers
      Try this out. Lots of fun. I tried it out too. Its very exciting 😛

    • Vajahat Ali 7:51 pm on October 5, 2009 Permalink | Log in to Reply

      Please let me know how to make that Electric Circuit, can you provide some diagram 🙂

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel