~liuxingcs/+junk/IM

« back to all changes in this revision

Viewing changes to libpurple/plugins/dbus-buddyicons-example.py

  • Committer: liuxing
  • Date: 2013-04-25 10:41:36 UTC
  • Revision ID: liuxingcs@yeah.net-20130425104136-e5towjtz19wsz1w7
Init IM

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#
 
3
# Print the aliases of buddies who have a buddy-icon set.
 
4
#
 
5
# Purple is the legal property of its developers, whose names are too numerous
 
6
# to list here.  Please refer to the COPYRIGHT file distributed with this
 
7
# source distribution.
 
8
#
 
9
# This program is free software; you can redistribute it and/or modify
 
10
# it under the terms of the GNU General Public License as published by
 
11
# the Free Software Foundation; either version 2 of the License, or
 
12
# (at your option) any later version.
 
13
#
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
#
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with this program; if not, write to the Free Software
 
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 
22
#
 
23
 
 
24
import dbus
 
25
 
 
26
bus = dbus.SessionBus()
 
27
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
 
28
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
 
29
 
 
30
node = purple.PurpleBlistGetRoot()
 
31
while node != 0:
 
32
        if purple.PurpleBlistNodeIsBuddy(node):
 
33
                icon = purple.PurpleBuddyGetIcon(node)
 
34
                if icon != 0:
 
35
                        print purple.PurpleBuddyGetAlias(node)
 
36
        node = purple.PurpleBlistNodeNext(node, 0)