Make NullClientCaps a singleto so that we don't create a new object for each contact.
This commit is contained in:
parent
65ba840cbd
commit
da0749b5d9
2 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "$(dirname $0)/src"
|
cd "$(dirname $0)/src"
|
||||||
exec python -OOt gajim.py "$@"
|
exec python -m cProfile gajim.py "$@"
|
||||||
|
|
|
@ -245,6 +245,16 @@ class NullClientCaps(AbstractClientCaps):
|
||||||
|
|
||||||
Assumes (almost) everything is supported.
|
Assumes (almost) everything is supported.
|
||||||
"""
|
"""
|
||||||
|
_instance = None
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Make it a singleton.
|
||||||
|
"""
|
||||||
|
if not cls._instance:
|
||||||
|
cls._instance = super(NullClientCaps, cls).__new__(
|
||||||
|
cls, *args, **kwargs)
|
||||||
|
return cls._instance
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
AbstractClientCaps.__init__(self, None, None)
|
AbstractClientCaps.__init__(self, None, None)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue