annotate libpurple/plugins/startup.py @ 17866:759cd72bd2ff

Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
author Andreas Monitzer <pidgin@monitzer.com>
date Mon, 18 Jun 2007 12:37:29 +0000
parents db06d4a18246
children 00cec200ec58
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16784
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:]))