~jtaylor/ubuntu/oneiric/gajim/multiple-CVE

« back to all changes in this revision

Viewing changes to src/common/configpaths.py

  • Committer: Bazaar Package Importer
  • Author(s): Nafallo Bjälevik
  • Date: 2008-11-16 00:26:27 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20081116002627-4olie99o2rqc7001
Tags: 0.12~beta1-0ubuntu1
* New upstream beta release:
  + Security improvements: End-to-End encryption, SSL certificat verification
  + Ability to minimize groupchats in roster
  + Chat to groupchat transformation
  + Block/Unblock contacts directly from roster
  + Single window mode
  + PEP support (User activity, mood and tune)
  + Security improvements: Kerberos (GSSAPI) SASL Authentication mechanism
  + Improve GUI of some windows
  + Fix handling of invalid XML
  + Fix freeze on connection
* Dropped all changes, patches and backports.
* src/common/passwords.py:
  - Change keyring to 'login', which is what gets unlocked at login.
* debian/copyright:
  - Updated for the GPL-3 change and for the amount of upstream authors.
* debian/control:
  - Update Standards-Version and drop XS for Vcs-Bzr.
  - Add Homepage and use ${shlibs:Depends}.
* debian/rules:
  - Update to not ignore errors from make clean.
  - Update with dh_shlibdeps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding:utf-8 -*-
 
2
## src/common/configpaths.py
 
3
##
 
4
## Copyright (C) 2006 Jean-Marie Traissard <jim AT lapin.org>
 
5
##                    Junglecow J <junglecow AT gmail.com>
 
6
## Copyright (C) 2006-2007 Yann Leboulanger <asterix AT lagaule.org>
 
7
## Copyright (C) 2007 Brendan Taylor <whateley AT gmail.com>
 
8
## Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
 
9
##
 
10
## This file is part of Gajim.
 
11
##
 
12
## Gajim is free software; you can redistribute it and/or modify
 
13
## it under the terms of the GNU General Public License as published
 
14
## by the Free Software Foundation; version 3 only.
 
15
##
 
16
## Gajim is distributed in the hope that it will be useful,
 
17
## but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
19
## GNU General Public License for more details.
 
20
##
 
21
## You should have received a copy of the GNU General Public License
 
22
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
 
23
##
 
24
 
1
25
import os
2
26
import sys
3
27
import tempfile
25
49
        '''Convert from filesystem encoding if not already Unicode'''
26
50
        return unicode(s, sys.getfilesystemencoding())
27
51
 
 
52
def windowsify(s):
 
53
        if os.name == 'nt':
 
54
                return s.capitalize()
 
55
        return s
 
56
 
28
57
class ConfigPaths:
29
58
        def __init__(self, root=None):
30
59
                self.root = root
68
97
                for key in self.paths.iterkeys():
69
98
                        yield (key, self[key])
70
99
 
71
 
def windowsify(s):
72
 
        if os.name == 'nt':
73
 
                return s.capitalize()
74
 
        return s
75
 
 
76
 
def init():
77
 
        paths = ConfigPaths()
78
 
 
79
 
        # LOG is deprecated
80
 
        k = ( 'LOG',   'LOG_DB',   'VCARD',   'AVATAR',   'MY_EMOTS' )
81
 
        v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons')
82
 
 
83
 
        if os.name == 'nt':
84
 
                v = map(lambda x: x.capitalize(), v)
85
 
 
86
 
        for n, p in zip(k, v):
87
 
                paths.add_from_root(n, p)
88
 
 
89
 
        paths.add('DATA', os.path.join(u'..', windowsify(u'data')))
90
 
        paths.add('HOME', fse(os.path.expanduser('~')))
91
 
        paths.add('TMP', fse(tempfile.gettempdir()))
92
 
 
93
 
        try:
94
 
                import svn_config
95
 
                svn_config.configure(paths)
96
 
        except (ImportError, AttributeError):
97
 
                pass
98
 
 
99
 
        # for k, v in paths.iteritems():
100
 
        #       print "%s: %s" % (repr(k), repr(v))
101
 
 
102
 
        return paths
103
 
 
104
 
gajimpaths = init()
105
 
 
106
 
def init_profile(profile, paths=gajimpaths):
107
 
        conffile = windowsify(u'config')
108
 
        pidfile = windowsify(u'gajim')
109
 
 
110
 
        if len(profile) > 0:
111
 
                conffile += u'.' + profile
112
 
                pidfile += u'.' + profile
113
 
        pidfile += u'.pid'
114
 
        paths.add_from_root('CONFIG_FILE', conffile)
115
 
        paths.add_from_root('PID_FILE', pidfile)
116
 
 
117
 
        # for k, v in paths.iteritems():
118
 
        #       print "%s: %s" % (repr(k), repr(v))
 
100
        def init(self, root = None):
 
101
                if root is not None:
 
102
                        self.root = root
 
103
 
 
104
                # LOG is deprecated
 
105
                k = ( 'LOG',   'LOG_DB',   'VCARD',   'AVATAR',   'MY_EMOTS',
 
106
                        'MY_ICONSETS', 'MY_MOOD_ICONSETS',
 
107
                        'MY_ACTIVITY_ICONSETS', 'MY_CACERTS')
 
108
                v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons',
 
109
                        u'iconsets',  u'moods', u'activities', u'cacerts.pem')
 
110
 
 
111
                if os.name == 'nt':
 
112
                        v = map(lambda x: x.capitalize(), v)
 
113
 
 
114
                for n, p in zip(k, v):
 
115
                        self.add_from_root(n, p)
 
116
 
 
117
                self.add('DATA', os.path.join(u'..', windowsify(u'data')))
 
118
                self.add('HOME', fse(os.path.expanduser('~')))
 
119
                self.add('TMP', fse(tempfile.gettempdir()))
 
120
 
 
121
                try:
 
122
                        import svn_config
 
123
                        svn_config.configure(self)
 
124
                except (ImportError, AttributeError):
 
125
                        pass
 
126
 
 
127
                # for k, v in paths.iteritems():
 
128
                #       print "%s: %s" % (repr(k), repr(v))
 
129
 
 
130
        def init_profile(self, profile = ''):
 
131
                conffile = windowsify(u'config')
 
132
                pidfile = windowsify(u'gajim')
 
133
                secretsfile = windowsify(u'secrets')
 
134
 
 
135
                if len(profile) > 0:
 
136
                        conffile += u'.' + profile
 
137
                        pidfile += u'.' + profile
 
138
                        secretsfile += u'.' + profile
 
139
                pidfile += u'.pid'
 
140
                self.add_from_root('CONFIG_FILE', conffile)
 
141
                self.add_from_root('PID_FILE', pidfile)
 
142
                self.add_from_root('SECRETS_FILE', secretsfile)
 
143
 
 
144
                # for k, v in paths.iteritems():
 
145
                #       print "%s: %s" % (repr(k), repr(v))
 
146
 
 
147
gajimpaths = ConfigPaths()
 
148
 
 
149
# vim: se ts=3: