Give your boss the illusion of managing you… with pidgin and dbus
by sudharsh
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()
Awesome. So nice. :)
just great.
Nice. You should also tell people that the script expects a file called “questions” in the current directory with a question on each line :)
Logs or it didn’t happen
I don’t have logs but I was hung upside down from the ceiling when my boss caught the act…
pics or it didnt happen
wtf? is this 4chan now?
A telepathy version of the script someone?
Logs or it didn’t happen..
You should modify the script so that you can see the results of your fun :-)
It opens up an IM window in pidgin anyway. So you do get to see the replies :P
That’s actually pretty brilliant… too bad my boss sits right around the corner from me. He’d come over and answer the questions in person…
Thanks for introducing me to the WTFPL.
Its also a valid Free Software license :P
Compatible with the GPL too i believe.
[…] coming across this article today on Reddit, I decided to cook up a little AppleScript to accomplish the same task for us Mac […]
carbon dating or it didnt happen
Not as cool as Python but I made an AppleScript version in case anyone was interested: http://www.tannr.com/?p=6
[…] Give your boss the illusion of managing you… with pidgin and dbussudharsh.wordpress.com […]
[…] Give your boss the illusion of managing you… with pidgin and dbus « Random Rants of a n… – […]
hell I did this in 10 minutes with applescript and adium. Funny thing is Adium uses the pidgin libraries, yet is SO MUCH THE MORE AWESOME.
Here is some of my output…
Would you like me to insert the screen and erase the bell?
Don’t you think I should blow on the server to rotate the document?
Can I populate the jack if I login to the application?
Unfortunately it seems like he installed an 8ball application to answer me…
Concentrate and ask again.
It is decidedly so.
Ask again later.
Here’s the code for an eight-ball responder.
#!/usr/bin/python
# By Vineel A, released under WTFPL
import dbus
import gobject
import time
import random
from dbus.mainloop.glib import DBusGMainLoop
def recieve(account, sender, message, conversation, flags):
## print ‘Account: ‘, account
## print ‘Sender: ‘, sender
## print ‘Message: ‘, message
## print ‘Conversation:’, conversation
## print ‘Flags: ‘, flags
answers = [‘As I see it, yes.’,
‘It is certain.’,
‘It is decidedly so.’,
‘Most likely.’,
‘Outlook good.’,
‘Signs point to yes.’,
‘Without a doubt.’,
‘Yes.’,
‘Yes – definitely.’,
‘You may rely on it.’,
‘Reply hazy, try again.’,
‘Ask again later.’,
‘Better not tell you now.’,
‘Cannot predict now.’,
‘Concentrate and ask again.’,
“Don’t count on it.”,
‘My reply is no.’,
‘My sources say no.’,
‘Outlook not so good.’,
‘Very doubtful.’]
answer = random.choice(answers)
bus = dbus.SessionBus()
obj = bus.get_object(‘im.pidgin.purple.PurpleService’,
‘/im/pidgin/purple/PurpleObject’)
purple = dbus.Interface(obj, ‘im.pidgin.purple.PurpleInterface’)
account_id = purple.PurpleAccountsGetAllActive()[0]
boss_conversation = purple.PurpleConversationNew(1, account_id, sender)
boss_im = purple.PurpleConvIm(boss_conversation)
time.sleep(1)
purple.PurpleConvImSend(boss_im, answer)
DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
bus.add_signal_receiver(recieve,
dbus_interface=’im.pidgin.purple.PurpleInterface’,
signal_name=’ReceivedImMsg’)
loop = gobject.MainLoop()
loop.run()
Praise me for posting this to reddit: http://www.reddit.com/r/programming/comments/99hed/give_your_boss_the_illusion_of_managing_you_with/
hi reddit.. thanks :D
[…] Give your boss the illusion of managing you… with pidgin and dbus « Random Rant… […]
Sup3rkiddo, you’ve grown up now… *sigh*
Awesome, btw :D
[…] Shared Give your boss the illusion of managing you… with pidgin and dbus « Random Rants of a n00b […]
[…] Give your boss the illusion of managing you… with pidgin and dbus « Random Rant… […]
[…] blogger: Sudharshan S derived inspiration from this strip to write himself a prank python script to keep the manager in his life ‘busy’ . A pretty neat idea… and with some […]
[…] Give your boss the illusion of managing you… with pidgin and dbus « Random Rants of a n00b […]
Not to be pointing out the obvious but wouldn’t it be easier to write these as Pidgin and Adium plugins?
True, but more brownie points are reserved for not-so-straightforward solutions when it comes to annoying your bosses ;)
For hottest information you have to pay a visit world-wide-web
and on world-wide-web I found this website as a most excellent
website for most recent updates.
Hi there, its good piece of writing concerning media print, we all know media is a wonderful source of data.
Hello! I could have sworn I’ve visited this website before but after looking at some of the posts I realized it’s new to me.
Nonetheless, I’m definitely happy I stumbled upon it and I’ll be bookmarking
it and checking back frequently!
What’s up friends, its wonderful article regarding
educationand completely defined, keep it up all the time.
I every time used to read piece of writing in news papers but now as I
am a user of web thus from now I am using net for posts, thanks to web.
Excellent post. I was checking constantly this
blog and I’m impressed! Very useful info specially the last part
:) I care for such info much. I was looking for this particular information for a very long time.
Thank you and best of luck.
With the right kind of info, the correct spirit and the
proper resources, you is going to be set into making a flourishing Internet business.
Affiliate programs are free to join and
several residual income opportunities will run you less than $100 to begin.
Lynn Van – Dyke’s site is now in the top 1% of all websites as outlined by Alexa.
That is a great tip especially to those fresh to the blogosphere.
Brief but very precise information… Appreciate your sharing this one.
A must read article!
Yes! Finally someone writes about whatsapp para iphone 4.1.
Way cool! Some extremely valid points! I appreciate you penning
this write-up plus the rest of the website is very good.
If you want to obtain much from this article then you have to apply such methods to your
won web site.
Hi there to every one, it’s in fact a pleasant for me to visit this web page, it
contains valuable Information.
I love it when ijdividuals get togfether and share opinions.
Great site, keep it up!
Pretty! This has been a really wonderful post.
Thanks for providing these details.
Hey there, You have done an incredible job. I’ll definitely
digg it and personally recommend to my friends. I am confident they will be benefited
from this web site.
At last! Someone with real exretpise gives us the answer. Thanks!