Pebbles

My thoughts, my expressions.

Turn Skype into your own Campfire desktop client

credits: http://www.clker.com/cliparts/

Tired of searching a desktop client for Campfire? Especially for Linux? Well, here is a simple solution. Just get pifire and skype4py packages installed on your Linux (mine is Ubuntu 10.10) and with a little python topping from your part, you are ready to go!

The campfire messages will be displayed on your Skype default contact ‘echo123′. You can post a reply back to campfire just by replying to the ‘echo123′ on Skype but by adding a handle ‘@camp’ in the message! Cool eh?

import pyfire
import Skype4Py

skype = Skype4Py.Skype()
skype.Attach()

def incoming(message):
 msg = ""
 user = ""
 if message.user:
 user = message.user.name

 if message.is_joining():
 msg = "\r\n%s ENTERS THE ROOM" % user
 elif message.is_leaving():
 msg = "\r\n%s LEFT THE ROOM" % user
 elif message.is_tweet():
 msg = "\r\n%s %s TWEETED '%s' - %s" % (user, message.tweet["user"], message.tweet["tweet"], message.tweet["url"])
 elif message.is_text():
 msg = "\r\n%s says: %s" % (user, message.body)
 elif message.is_upload():
 msg = "\r\n%s UPLOADED FILE %s: %s" % (user, message.upload["name"],
 message.upload["url"])
 elif message.is_topic_change():
 msg = "\r\n%s CHANGED TOPIC TO '%s'" % (user, message.body)

 skype.CreateChatWith('echo123').SendMessage(msg)

def error(e):
 print("Stream STOPPED due to ERROR: %s" % e)
 print("Press ENTER to continue")

campfire = pyfire.Campfire("yourdomain.campfirenow.com", "campfireusername", "campfirepass", ssl=True)
room = campfire.get_room_by_name("CampfireRoomName")
room.join()

stream = room.get_stream(error_callback=error)
stream.attach(incoming).start()

def monitor_message(msg, stat):
 message = msg.Body
 if "@camp" in message and stat == "SENT":
 message = message.replace("@camp ", "")
 print "Sending to campfire: %s" % message
 room.speak(message)

skype.OnMessageStatus = monitor_message

raw_input("Waiting for messages (Press ENTER to finish)\n")
stream.stop().join()
room.leave()

Happy SkypeFire :) !

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.