[Telepathy] Sending and receiving text messages (was: Re: SIP for Croatian Vipnet network)

Jiri Baum jiri at baum.com.au
Fri Feb 6 08:43:00 PST 2009


Hi,

> Ivan Vučica wrote:
> >  From what I understand, using Telepathy I should be able to "plug in"
> > to existing connections created using Empathy. I have absolutely zero
> > experience with DBus and Telepathy, but I would love to implement it
> > into a MMORPG client I'm working on ( http://yetanother.tibiaclient.com/
> > ). Are there any helpful, simple but complete C examples? Python example
> > on the wiki doesn't exactly show how to receive or send messages. A
> > simple printf()+scanf() based example would be of great help. Googling
> > didn't help exactly.
> > Any such example out there?

I'm not sure if you're still interested in this, but I seem to have written 
one on Wednesday (though again it's in Python); I was aiming for a D-Tubes 
example, but along the way I did try sending text messages. Now that I test 
it, receiving text messages works too.

http://www.baum.com.au/~jiri/tubes/tubes-howto.html
(and pick the example-text.py file)

Disclaimer: I know fairly little about telepathy; I wrote that howto and the 
examples to learn more...

Senko Rasic:
> One part that telepathy-glib doesn't cover at the moment is actually
> figuring out which accounts are online (and getting the connections),

On the other hand, it's only a couple of calls to get the list and convert it 
to a Telepathy connection:

    bus = dbus.SessionBus()
    mc = bus.get_object('org.freedesktop.Telepathy.MissionControl',
                        '/org/freedesktop/Telepathy/MissionControl')
    for conn in mc.GetOnlineConnections():
        print conn
        conn = telepathy.client.Connection(*mc.GetConnection(conn))
        # ... do stuff with conn ...


Linking in libempathy just for that seems a bit of an overkill, unless you're 
using it for other things too.


Jiri
-- 
Jiri Baum <jiri at baum.com.au>                   http://www.baum.com.au/~jiri


More information about the telepathy mailing list