Mercurial > pidgin.yaz
annotate libpurple/plugins/startup.py @ 17240:ee58212687bb
Plug a few more memory leaks for some perl plugins.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 22 May 2007 11:01:14 +0000 |
parents | db06d4a18246 |
children | 00cec200ec58 |
rev | line source |
---|---|
16795
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 # |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 # Makes sure only one purple instance is running |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 # |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 # Purple is the legal property of its developers, whose names are too numerous |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 # to list here. Please refer to the COPYRIGHT file distributed with this |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 # source distribution. |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 # |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 # This program is free software; you can redistribute it and/or modify |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 # it under the terms of the GNU General Public License as published by |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 # the Free Software Foundation; either version 2 of the License, or |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 # (at your option) any later version. |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 # |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 # This program is distributed in the hope that it will be useful, |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 # GNU General Public License for more details. |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 # |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 # You should have received a copy of the GNU General Public License |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 # along with this program; if not, write to the Free Software |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 # |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 import sys |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 import dbus |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 import os |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 home = os.path.expanduser('~/.purple/') |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 for arg in range(1, len(sys.argv[1:])): |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 if sys.argv[arg] == "-c": |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 home = os.path.expanduser(sys.argv[arg + 1]) |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 break |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 bus = dbus.SessionBus() |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 try: |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 userdir = purple.PurpleUserDir() |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 if not os.path.isabs(userdir): |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 userdir = os.path.join(purple.PurpleHomeDir(), userdir) |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 if home == userdir: |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 print "Already running." |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 purple.PurpleBlistShow() |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 else: |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 print "Starting client from a different home directory." |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 raise |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 except: |
db06d4a18246
Add a python script plugins/startup.py which will first check whether a
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 os.execlp(sys.argv[1], " ".join(sys.argv[2:])) |