Mercurial > libervia-backend
annotate frontends/src/quick_frontend/quick_chat_list.py @ 1147:736f1dd6e142
plugin OTR: two small fixes
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 01 Sep 2014 16:11:45 +0200 |
parents | 75025461141f |
children |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
4 # helper class for making a SAT frontend |
811 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org) |
0 | 6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
10 # (at your option) any later version. |
0 | 11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
15 # GNU Affero General Public License for more details. |
0 | 16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
587
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
0 | 19 |
1139
75025461141f
move sat.tools.jid to sat_frontends.tools.jid
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
20 from sat_frontends.tools.jid import JID |
0 | 21 |
22 | |
23 class QuickChatList(dict): | |
24 """This class is used to manage the list of chat windows. | |
25 It act as a dict, but create a chat window when the name is found for the first time.""" | |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
26 |
0 | 27 def __init__(self, host): |
28 dict.__init__(self) | |
29 self.host = host | |
30 | |
639
99eee75ec1b7
core: better handling of profile_key and don't write the param file anymore
souliane <souliane@mailoo.org>
parents:
638
diff
changeset
|
31 def __getitem__(self, to_jid): |
99eee75ec1b7
core: better handling of profile_key and don't write the param file anymore
souliane <souliane@mailoo.org>
parents:
638
diff
changeset
|
32 target = JID(to_jid) |
688
f7878ad3c846
tools: renamed tools.jid.JID attribute "short" to "bare"
souliane <souliane@mailoo.org>
parents:
639
diff
changeset
|
33 if not target.bare in self: |
0 | 34 #we have to create the chat win |
688
f7878ad3c846
tools: renamed tools.jid.JID attribute "short" to "bare"
souliane <souliane@mailoo.org>
parents:
639
diff
changeset
|
35 self[target.bare] = self.createChat(target) |
f7878ad3c846
tools: renamed tools.jid.JID attribute "short" to "bare"
souliane <souliane@mailoo.org>
parents:
639
diff
changeset
|
36 return dict.__getitem__(self, target.bare) |
0 | 37 |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
38 def createChat(self, target): |
0 | 39 raise NotImplementedError |