Sun, 01 Oct 2006 15:14:05 +0000
[gaim-migrate @ 17416]
Don't dereference things before we check if they are NULL
|
13557
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
1 | #!/usr/bin/env python |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
2 | # |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
3 | # Print the aliases of buddies who have a buddy-icon set. |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
4 | # |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
5 | # Gaim is the legal property of its developers, whose names are too numerous |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
6 | # to list here. Please refer to the COPYRIGHT file distributed with this |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
7 | # source distribution. |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
8 | # |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
9 | # This program is free software; you can redistribute it and/or modify |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
10 | # it under the terms of the GNU General Public License as published by |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
11 | # the Free Software Foundation; either version 2 of the License, or |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
12 | # (at your option) any later version. |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
13 | # |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
14 | # This program is distributed in the hope that it will be useful, |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
17 | # GNU General Public License for more details. |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
18 | # |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
19 | # You should have received a copy of the GNU General Public License |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
20 | # along with this program; if not, write to the Free Software |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
22 | # |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
23 | |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
24 | import dbus |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
25 | |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
26 | bus = dbus.SessionBus() |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | obj = bus.get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject") |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
28 | gaim = dbus.Interface(obj, "net.sf.gaim.GaimInterface") |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
29 | |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
30 | node = gaim.GaimBlistGetRoot() |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
31 | while node != 0: |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | if gaim.GaimBlistNodeIsBuddy(node): |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
33 | icon = gaim.GaimBuddyGetIcon(node) |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
34 | if icon != 0: |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | print gaim.GaimBuddyGetAlias(node) |
|
d68e9d0cc1b1
[gaim-migrate @ 15934]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
36 | node = gaim.GaimBlistNodeNext(node, 0) |