hi all

After long time to read pidgin API, i can update my python script for Gaim in python script for Pidgin.

*Description :*
when a contact is connected, Tux Droid opens the mouth, and says alias contact to you

TODO LIST
=========
- make some actions when a conversation started
- Internationalization

Regards,

Thomas CARPENTIER



#!/usr/bin/env python
# -*- coding: utf-8 -*-

# -----------------------------------------------------------------------------
# Tux Droid - Pidgin InterFace
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# -----------------------------------------------------------------------------
# $Id: $
# -----------------------------------------------------------------------------

"""
CHANGES
=======
2007/05/21 - version 0.1:
    - initial version

TODO LIST
=========
- make some actions when a conversation started
- Internationalization 

"""

__author__  = "Thomas CARPENTIER <[EMAIL PROTECTED]>"
__appname__ = "TuxPidgin"
__version__ = "0.1"
__date__    = "2007/05/21"
__license__ = "GPL"


# -----------------------------------------------
# Initalization of modules
# uses objects "tux" and "tss"
# -----------------------------------------------
import sys
sys.path.append('/opt/tuxdroid/api/python')
from tux import *
# -----------------------------------------------
# Your script
# -----------------------------------------------


import dbus
import dbus.glib
import dbus.decorators
import gobject
import os
import doctest
     
def buddysignedon(bId):
    #Get buddy's name and say it
    alias = pidgin.PurpleBuddyGetAlias(bId)
    buddyName = pidgin.PurpleBuddyGetName(bId)
    'buddyName = email '
    text = "%s vient de se connecter" % alias
    """ Test if text is an unicode instance
    >>>isinstance(text, unicode)
    True
    """
    text2=text.encode('utf-8')
    print isinstance(text2, unicode)
    tux.cmd.mouth_open()
    tux.tts.select_voice(2,100)
    tux.tts.speak(text2)
    tux.cmd.mouth_close()
    

    
bus = dbus.SessionBus()
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
pidgin = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")


bus.add_signal_receiver(buddysignedon,
                        dbus_interface = "im.pidgin.purple.PurpleInterface",
                        signal_name = "BuddySignedOn")

loop = gobject.MainLoop()
loop.run()
if __name__ == "__main__":
     doctest.testmod()
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
tux-droid-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-user

Reply via email to