Le jeudi 11 octobre 2012 à 21:29 +0200, Rainer Dorsch a écrit :
> Am Tuesday 09 October 2012 schrieb Guillaume Desmottes:
> > Le lundi 08 octobre 2012 à 22:19 +0200, Rainer Dorsch a écrit :
> > > Am Monday 08 October 2012 schrieb Guillaume Desmottes:
> > > > Le vendredi 05 octobre 2012 à 23:47 +0200, Rainer Dorsch a écrit :
> > > > > I am struggling somewhat with the empathy logs. I can only select
> > > > > Empathy.FileTransfer in the Empathy debug view. For reference I
> > > > > uploaded some logs to
> > > > > 
> > > > > http://bokomoko.de/~rd/telepathy/
> > > > 
> > > > Looking at this log you are connected using kathrin.dor...@jabber.org
> > > > and receive a location from rdor...@jabber.org, but you say that
> > > > Empathy doesn't display any location for rdor...@jabber.org is that
> > > > right?
> > > 
> > > Yes, that is correct.
> > 
> > Sounds like, at least, like an Empathy bug then. Please report one. :)
> 
> I opened a bug report
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=55884
> 
> BTW, since the location seems to be transfered correctly, how much is missing 
> to build a cmd line jabber client, which could write the location to disk 
> (e.g. as gpx)? If you think less than a day of work, can you give me some 
> pointers to get started (e.g. is there a hello world like app, which logs 
> into 
> a jabber server and logs the conversation, account information hardcoded is 
> fine as a hello world like starting point...)

It shouldn't be too hard. Actually I already have a small test script
listing the location of all your contacts.

Check telepathy-glib API reference if you want to tweak it.


        G.
#!/usr/bin/env python

import os
import datetime

from gi.repository import GObject
GObject.threads_init()

from gi.repository import TelepathyGLib as Tp

def display_location(account, contact):
    assert contact.has_feature(Tp.ContactFeature.LOCATION)
    location = contact.get_location()
    if len(location) == 0:
        return

    try:
        timestamp = location['timestamp']
        d = datetime.datetime.fromtimestamp(timestamp)
        timestamp = d.strftime('%c')
    except KeyError:
        timestamp = ''

    print "%s" % contact.get_identifier()
    print "\ton %s" % account.get_path_suffix()
    print "\t%s" % timestamp
    print "\t%r" % location
    print ""

def manager_prepared_cb(manager, result, loop):
    manager.prepare_finish(result)

    for account in manager.get_valid_accounts():
        connection = account.get_connection()

        if connection is None:
            continue

        self_contact = connection.get_self_contact()
        display_location(account, self_contact)

        # Verify account is online and received its contact list. If state is not
        # SUCCESS this means we didn't received the roster from server yet and
        # we would have to wait for the "notify:contact-list-state" signal. */
        if connection.get_contact_list_state() == Tp.ContactListState.SUCCESS:
            contacts = connection.dup_contact_list()
            for contact in contacts:
                display_location(account, contact)
    loop.quit()

if __name__ == '__main__':
    Tp.debug_set_flags(os.getenv('EXAMPLE_DEBUG', ''))

    loop = GObject.MainLoop()
    manager = Tp.AccountManager.dup()
    factory = manager.get_factory()
    factory.add_account_features([Tp.Account.get_feature_quark_connection()])
    factory.add_connection_features([Tp.Connection.get_feature_quark_contact_list()])
    factory.add_contact_features([Tp.ContactFeature.LOCATION])

    manager.prepare_async(None, manager_prepared_cb, loop)
    loop.run()
_______________________________________________
telepathy mailing list
telepathy@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/telepathy

Reply via email to