Codelog

foreach(Snippet aSnippet in CodeLog){ aSnippet.GetSolution(); }

Give your boss the illusion of managing you… with pidgin and dbus

with 2 comments

Dilbert.com

Oh yeah!. With the power of DBus and libpurple APIs it is possible to give your boss the illusion of managing you. Just run the following script (under WTFPL). Tested with jabber accounts in a live office environment :P.

#!/usr/bin/env python
# By Sudharshan S, released under WTFPL
 
import dbus
import gobject
import time
 
class PointyHairedBoss:
 
    def __init__(self, boss_id, source, frequency=30):
        self.boss_id = boss_id
        self.source = source
        self.frequency = frequency
        bus = dbus.SessionBus()
        _pidgin_proxy = bus.get_object("im.pidgin.purple.PurpleService", \
                                                       "/im/pidgin/purple/PurpleObject")
        self.purple = dbus.Interface (_pidgin_proxy, "im.pidgin.purple.PurpleService")
        # FIXME:
        account_id = self.purple.PurpleAccountsGetAllActive()[0]
        self.boss_conversation = self.purple.PurpleConversationNew(1, account_id, self.boss_id)
        self.boss_im = self.purple.PurpleConvIm(self.boss_conversation)
        print self.boss_im
 
    def start_nonsense(self):
        question_list = open(self.source)
        for q in question_list:
            self.purple.PurpleConvImSend(self.boss_im, q)
            time.sleep(self.frequency)
 
if __name__ == "__main__":
   # Change the jabber id and the path to your questions, with an optional frequency
   o = PointyHairedBoss("foo@gmail.com", "questions")
   o.start_nonsense()

Written by sup3rkiddo

July 5th, 2009 at 11:37 am

2 Responses to 'Give your boss the illusion of managing you… with pidgin and dbus'

Subscribe to comments with RSS or TrackBack to 'Give your boss the illusion of managing you… with pidgin and dbus'.

  1. LOL :)
    But you should have made the boss as a script returning a YES/NO answer ;)

    Miky

    31 Jul 09 at 11:11 am

  2. [...] Give your boss the illusion of managing you… with pidgin and dbus at Codelog codelog.blogial.com/2009/07/05/give-your-boss-the-illusion-of-managing-you-with-pidgin-and-dbus – view page – cached foreach(Snippet aSnippet in CodeLog){ aSnippet.GetSolution(); } [...]

Leave a Reply