changeset a5f8fa8a32f5 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=a5f8fa8a32f5
description: add jingle_xtls.py, get_context helper function
diffstat:
src/common/jingle_ft.py | 1 +
src/common/jingle_xtls.py | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diffs (58 lines):
diff -r 01e0c164fe49 -r a5f8fa8a32f5 src/common/jingle_ft.py
--- a/src/common/jingle_ft.py Mon Jul 26 20:57:11 2010 +0800
+++ b/src/common/jingle_ft.py Tue Jul 27 13:02:44 2010 +0800
@@ -93,6 +93,7 @@
file_props['session-type'] = 'jingle'
self.use_security = bool(content.getTag('security'))
+ # TODO: extract fingerprint element, encryption method element for later use
file_tag = content.getTag('description').getTag('offer').getTag('file')
for attribute in file_tag.getAttrs():
diff -r 01e0c164fe49 -r a5f8fa8a32f5 src/common/jingle_xtls.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/common/jingle_xtls.py Tue Jul 27 13:02:44 2010 +0800
@@ -0,0 +1,43 @@
+# -*- coding:utf-8 -*-
+## src/common/jingle_xtls.py
+##
+## This file is part of Gajim.
+##
+## Gajim is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published
+## by the Free Software Foundation; version 3 only.
+##
+## Gajim is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+##
+
+import logging
+log = logging.getLogger('gajim.c.jingle_xtls')
+
+PYOPENSSL_PRESENT = False
+
+try:
+ import OpenSSL
+ PYOPENSSL_PRESENT = True
+ from OpenSSL import SSL, Context
+except ImportError:
+ log.info("PyOpenSSL not available")
+
+def default_callback(connection, certificate, error_num, depth, return_code):
+ log.info("certificate: %s" % certificate)
+ return return_code
+
+def get_context(fingerprint, verify_cb=None):
+ """
+ constructs and returns the context objects
+ """
+ ctx = SSL.Context(TLSv1_METHOD)
+ ctx.set_verify(SSL.VERIFY_PEER|SSL.VERIFY_FAIL_IF_NO_PEER_CERT, verify_cb or default_callback)
+ # TODO: set private key, set certificate, set verification path
+ return ctx
+
changeset b646c6b46d33 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=b646c6b46d33
description: l10n: Updated Kazakh (kk) translation to 100%
New status: 2101 messages complete with 0 fuzzies and 0 untranslated.
Transmitted-via: Transifex (www.transifex.net).
diffstat:
po/kk.po | 154 +++++++++++++++++++++++++++++++++++---------------------------
1 files changed, 87 insertions(+), 67 deletions(-)
diffs (truncated from 515 to 300 lines):
diff -r 75d28a6dbaa1 -r b646c6b46d33 po/kk.po
--- a/po/kk.po Sat Jul 24 22:14:23 2010 +0200
+++ b/po/kk.po Mon Jul 26 02:10:11 2010 +0000
@@ -8,7 +8,7 @@
"Project-Id-Version: gajim.trunk\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-06-30 10:15+0600\n"
-"PO-Revision-Date: 2010-07-12 10:35+0600\n"
+"PO-Revision-Date: 2010-07-25 00:16+0600\n"
"Last-Translator: Baurzhan Muftakhidinov <baurthefirst(a)gmail.com>\n"
"Language-Team: Kazakh <kk_KZ(a)googlegroups.com>\n"
"Language: kk\n"
@@ -1840,11 +1840,11 @@
#: ../data/gui/preferences_window.ui.h:58
msgid "Gajim can send and receive meta-information related to a conversation you may have with a contact. Here you can specify which chatstates you want to display in chat windows."
-msgstr ""
+msgstr "Контактпен сөйлесу кезінде Gajim ол сөйлесуге қатысты мета-ақпаратты жібере мен қабылдай алады. Чат терезелерінде қай чат күйлерін көрсетуді осында таңдай аласыз."
#: ../data/gui/preferences_window.ui.h:59
msgid "Gajim can send and receive meta-information related to a conversation you may have with a contact. Here you can specify which chatstates you want to send to the other party."
-msgstr ""
+msgstr "Контактпен сөйлесу кезінде Gajim ол сөйлесуге қатысты мета-ақпаратты жібере мен қабылдай алады. Екінші жаққа қай чат күйлерін жіберуді осында таңдай аласыз."
#: ../data/gui/preferences_window.ui.h:60
msgid "Gajim will notify you via a popup window in the bottom right of the screen about contacts that just signed out"
@@ -3394,7 +3394,7 @@
#: ../src/common/config.py:105
msgid "List (space separated) of rows (accounts and groups) that are collapsed."
-msgstr ""
+msgstr "Жиналған жолдар (тіркелгілер мен топтар) тізімі (бос аралықпен ажыратылсын)."
#. sorted alphanum
#: ../src/common/config.py:106
@@ -3422,7 +3422,7 @@
#: ../src/common/config.py:114
msgid "Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable fuzzyclock. 1 is the most precise clock, 4 the least precise one. This is used only if print_time is 'sometimes'."
-msgstr ""
+msgstr "Чаттарда уақытты Қызық Сағат көмегімен шығару. Қызықтылық мәні 1 мен 4 арасында, 0 ол сағатты сөндіреді. 1 тура сағат үшін, 4 ең тура емес үшін. Бұл тек print_time опциясы 'sometimes' мәнінде болса ғана қолданылады."
#: ../src/common/config.py:117
msgid "Treat * / _ pairs as possible formatting characters."
@@ -3434,31 +3434,31 @@
#: ../src/common/config.py:121
msgid "Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)"
-msgstr ""
+msgstr "HTML жіберу үшін ReStructured text markup қолдану, және таңдалған болса, ascii пішімдеу. Синтаксисі үшін, http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html қараңыз (Осыны қолданам десеңіз, docutils орнатыңыз)"
#: ../src/common/config.py:130
msgid "Character to add after nickname when using nick completion (tab) in group chat."
-msgstr ""
+msgstr "Топтық чатта ник аттарын автотолықтыру (tab пернесі) қолдану кезінде ник атының артына қосылатын таңба."
#: ../src/common/config.py:131
msgid "Character to propose to add after desired nickname when desired nickname is used by someone else in group chat."
-msgstr ""
+msgstr "Таңдалған ник атын чатта біреу қолданып тұрса, ол ник аты артына қосуға ұсынылатын таңба."
#: ../src/common/config.py:159
msgid "This option let you customize timestamp that is printed in conversation. For exemple \"[%H:%M] \" will show \"[hour:minute] \". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html"
-msgstr ""
+msgstr "Бұл опция сізге сөйлесулердегі уақыт көрсетілуін баптауға мүмкіндік береді. Мысалы, \"[%H:%M] \" болса, \"[сағат:минут] \" ретінде көрсетіледі. Көбірек білу үшін python құжаттамасынан strftime үшін ақпаратты қараңыз: http://docs.python.org/lib/module-time.html"
#: ../src/common/config.py:160
msgid "Characters that are printed before the nickname in conversations"
-msgstr ""
+msgstr "Сөйлесулерде ник атына дейін қойылатын таңбалар"
#: ../src/common/config.py:161
msgid "Characters that are printed after the nickname in conversations"
-msgstr ""
+msgstr "Сөйлесулерде ник атынан кейін қойылатын таңбалар"
#: ../src/common/config.py:165
msgid "Add * and [n] in roster title?"
-msgstr "Ростер атауыны * мен [n] қосу керек пе?"
+msgstr "Ростер атауына * мен [n] қосу керек пе?"
#: ../src/common/config.py:166
msgid "How many lines to remember from previous conversation when a chat tab/window is reopened."
@@ -3491,7 +3491,7 @@
#: ../src/common/config.py:177
#, python-format
msgid "Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary."
-msgstr ""
+msgstr "%s бар таңдауыңызша сілтеме, бұл жерде %s - сөз не мәтін, немесе 'WIKTIONARY', яғни, wiktionary қолдану."
#: ../src/common/config.py:180
msgid "If checked, Gajim can be controlled remotely using gajim-remote."
@@ -3527,11 +3527,11 @@
#: ../src/common/config.py:189
msgid "Ask before closing tabbed chat window if there are control that can loose data (chat, private chat, groupchat that will not be minimized)"
-msgstr ""
+msgstr "Беттері бар терезені жабу алдында сұрау, егер ақпаратты жоғалту мүмкіндігі болса (чат, жеке чат, қайырылмайтын топтық чат)"
#: ../src/common/config.py:192
msgid "Comma separated list of hosts that we send, in addition of local interfaces, for File Transfer in case of address translation/port forwarding."
-msgstr ""
+msgstr "Жергілікті интерфейстерге қоса, үтірмен ажыратылған хост аттары, адрес/порттар бағдарлауы кезінде Файлдармен алмасу үшін оларды жібереміз."
#: ../src/common/config.py:194
msgid "IEC standard says KiB = 1024 bytes, KB = 1000 bytes."
@@ -3555,7 +3555,7 @@
#: ../src/common/config.py:205
msgid "A list of modp groups to use in a Diffie-Hellman, highest preference first, separated by commas. Valid groups are 1, 2, 5, 14, 15, 16, 17 and 18. Higher numbers are more secure, but take longer to calculate when you start a session."
-msgstr ""
+msgstr "Diffie-Hellman қолдану үшін modp топтар тізімі, үлкенірек баптау бірінші болсын, үтірмен ажыратылсын. Дұрыс топтар 1, 2, 5, 14, 15, 16, 17 және 18. Үлкенірек нөмірлер қауіпсіздігі жоғарырақ, бірақ сессияны бастау кезінде оны есептеу үшін көбірек уақыт кетеді."
#: ../src/common/config.py:214
msgid "Preview new messages in notification popup?"
@@ -3563,7 +3563,7 @@
#: ../src/common/config.py:219
msgid "A semicolon-separated list of words that will be highlighted in group chats."
-msgstr ""
+msgstr "Топтық чаттарда түспен ерекшелеу үшін сөздер тізімі, нүктелі үтірмен ажыратылсын."
#: ../src/common/config.py:220
msgid "If True, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if trayicon is used."
@@ -3591,11 +3591,11 @@
#: ../src/common/config.py:231
msgid "If False, Gajim will no longer print status line in chats when a contact changes his or her status and/or his or her status message."
-msgstr ""
+msgstr "Сөндірілген болса, Gajim чаттарда контакт өз күйін не күй хабарламасын өзгертсе, күй жолын енді жазбайды."
#: ../src/common/config.py:232
msgid "can be \"none\", \"all\" or \"in_and_out\". If \"none\", Gajim will no longer print status line in groupchats when a member changes his or her status and/or his or her status message. If \"all\" Gajim will print all status messages. If \"in_and_out\", Gajim will only print FOO enters/leaves group chat."
-msgstr ""
+msgstr "\"none\", \"all\" не \"in_and_out\" бола алады. Егер \"none\" болса, Gajim топтық чаттарда мүше өз күйін не күй хабарламасын өзгертсе, күй хабарламасы жолын шығармайды. Егер \"all\" болса, Gajim барлық күй хабарламаларын көрсетеді. Егер \"in_and_out\" болса, Gajim тек БІРЕУ топтық чатқа кірді/шықты хабарламаларын көрсетеді."
#: ../src/common/config.py:234
msgid "Background color of contacts when they just signed in."
@@ -3623,7 +3623,7 @@
#: ../src/common/config.py:242
msgid "Jabberd1.4 does not like sha info when one join a password protected group chat. Turn this option to False to stop sending sha info in group chat presences."
-msgstr ""
+msgstr "Jabberd1.4 парольмен қорғалған топтық чатқа біреу кірген кезде sha ақпаратын ұнатпайды. Топтық чаттың бар болу хабарламаларында sha ақпаратын көрсетпеу үшін бұл опцияны сөндіріңіз."
#. always, never, peracct, pertype should not be translated
#: ../src/common/config.py:245
@@ -3635,6 +3635,12 @@
"'peracct' - Messages for each account are sent to a specific window.\n"
"'pertype' - Each message type (e.g., chats vs. groupchats) are sent to a specific window."
msgstr ""
+"Жаңа хабарламалар көрсетілетін терезені басқару.\n"
+"'always' - Барлық хабарламалар бір терезеге жіберіледі.\n"
+"'always_with_roster' - 'always' сияқты, бірақ хабарламалар бар бір терезе ростермен бір терезені құрайды.\n"
+"'never' - Барлық хабарламалар жеке терезелерінде.\n"
+"'peracct' - Әр тіркелгі үшін хабарламалар жеке терезеде.\n"
+"'pertype' - Хабарламалар түрі бойынша (мыс. чат не топтық чаттар) терезеге жіберіледі."
#: ../src/common/config.py:246
msgid "If False, you will no longer see the avatar in the chat window."
@@ -3662,11 +3668,11 @@
#: ../src/common/config.py:252
msgid "In a chat, show the nickname at the beginning of a line only when it's not the same person talking than in previous message."
-msgstr ""
+msgstr "Чатта, алдыңғы хабарламадағы адам емес болмаса ғана, жол басынан контакт атын көрсету."
#: ../src/common/config.py:253
msgid "Indentation when using merge consecutive nickname."
-msgstr ""
+msgstr "Біріккен тізбекті ник атын қолдану кезіндегі шегіну."
#: ../src/common/config.py:254
msgid "Smooth scroll message in conversation window"
@@ -3682,19 +3688,19 @@
#: ../src/common/config.py:257
msgid "Should we show the confirm metacontacts creation dialog or not? Empty string means we never show the dialog."
-msgstr ""
+msgstr "Метаконтакттарды жасауды растау сұхбатын көрсету керек пе? Бос жол терезені ешқашан көрсетпеуді белгілейді."
#: ../src/common/config.py:258
msgid "Should we show the confirm block contact dialog or not? Empty string means we never show the dialog."
-msgstr ""
+msgstr "Контактты блоктауды растау сұхбатын көрсету керек пе? Бос жол терезені ешқашан көрсетпеуді белгілейді."
#: ../src/common/config.py:259
msgid "Should we show the confirm custom status dialog or not? Empty string means we never show the dialog."
-msgstr ""
+msgstr "Таңдауыңызша күйді растау сұхбатын көрсету керек пе? Бос жол терезені ешқашан көрсетпеуді белгілейді."
#: ../src/common/config.py:260
msgid "If True, you will be able to set a negative priority to your account in account modification window. BE CAREFUL, when you are logged in with a negative priority, you will NOT receive any message from your server."
-msgstr ""
+msgstr "Қосулы тұрса, тіркелгіні баптау терезесінде сіз приоритеттің теріс мәнің орната аласыз. АБАЙЛАҢЫЗ, теріс приоритетпен отырған кезде, серверден бірде-бір хабарламаны АЛМАЙСЫЗ."
#: ../src/common/config.py:261
msgid "If True, Gajim will use Gnome Keyring (if available) to store account passwords."
@@ -3706,23 +3712,23 @@
#: ../src/common/config.py:263
msgid "If True, Gajim will show number of online and total contacts in account and group rows."
-msgstr ""
+msgstr "Қосулы тұрса, Gajim желідегі мен барлық контакттар санын тіркелгі мен топтар жолында көрсетеді."
#: ../src/common/config.py:264
msgid "Can be empty, 'chat' or 'normal'. If not empty, treat all incoming messages as if they were of this type"
-msgstr ""
+msgstr "Бос, 'chat' не 'normal' түрде бола алады. Бос емес болса, кірген хабарламалардың барлығын осы түрде деп есептеу"
#: ../src/common/config.py:265
msgid "If True, Gajim will scroll and select the contact who sent you the last message, if chat window is not already opened."
-msgstr ""
+msgstr "Қосулы болса, Gajim сізге соңғы болып хабарламаны жіберген контактты белгілейді, егер чат терезесі ашылған болмаса."
#: ../src/common/config.py:266
msgid "If True, Gajim will convert string between $$ and $$ to an image using dvips and convert before insterting it in chat window."
-msgstr ""
+msgstr "Қосулы болса, Gajim $$ және $$ таңбалары арасындағы жолды чат терезесіне орналастырмас бұрын, dvips пен convert көмегімен суретке айналдырады."
#: ../src/common/config.py:267
msgid "Time of inactivity needed before the change status window closes down."
-msgstr ""
+msgstr "Күйді өзгерту терезесі жабылу үшін керек белсенді еместік уақыт шамасы."
#: ../src/common/config.py:268
msgid "Maximum number of lines that are printed in conversations. Oldest lines are cleared."
@@ -3730,7 +3736,7 @@
#: ../src/common/config.py:269
msgid "If True, notification windows from notification-daemon will be attached to systray icon."
-msgstr ""
+msgstr "Қосулы болса, notification-daemon жіберген хабарламалар терезелері жүйелік трейден көрсетіледі."
#: ../src/common/config.py:270
msgid "Choose interval between 2 checks of idleness."
@@ -3738,35 +3744,35 @@
#: ../src/common/config.py:271
msgid "Change the value to change the size of latex formulas displayed. The higher is larger."
-msgstr ""
+msgstr "Көрсетілетін latex формулалар өлшемдерін өзгерту. Жоғары мән үлкенін білдіреді."
#: ../src/common/config.py:272
msgid "Valid uri schemes. Only schemes in this list will be accepted as \"real\" uri. (mailto and xmpp are handled separately)"
-msgstr ""
+msgstr "Дұрыс uri схемелары. Тек осы тізімдегі схемалар ғана \"шын\" uri ретінде қабылданады. (mailto және xmpp бөлек өнделеді)"
#: ../src/common/config.py:273
msgid "Ask offline status message to all offline contacts when connection to an accoutn is established. WARNING: This causes a lot of requests to be sent!"
-msgstr ""
+msgstr "Тіркелгіге байланыс орнатылған кезде барлық желіде емес контакттардан желіде емес күй хабарламасын сұрау. ЕСКЕРТУ: Бұл көп сұранымдардың жіберілуіне әкеп соғады!"
#: ../src/common/config.py:274
msgid "If True, completion in groupchats will be like a shell auto-completion"
-msgstr ""
+msgstr "Қосулы тұрса, топ чаттардағы мәтінді автотолықтыру қоршамдағыдай іске асады"
#: ../src/common/config.py:275
msgid "When is self contact row displayed. Can be \"always\", \"when_other_resource\" or \"never\""
-msgstr ""
+msgstr "Өз контакт жолы қашан көрсетіледі. Келесіден біреу болсын: \"always\", \"when_other_resource\" немесе \"never\""
#: ../src/common/config.py:280
msgid "Optionally fix jingle output video framerate. Example: 10/1 or 25/2"
-msgstr ""
+msgstr "Осыған қоса, jingle шығыс видеосының кадр/сек қасиетін автоөзгерту. Мысалы: 10/1 не 25/2"
#: ../src/common/config.py:281
msgid "Optionally resize jingle output video. Example: 320x240"
-msgstr ""
+msgstr "Осыған қоса, jingle шығыс видеосының өлшемін автоөзгерту. Мысалы: 320x240"
#: ../src/common/config.py:284
msgid "If True, Gajim will try to use a STUN server when using jingle. The one in \"stun_server\" option, or the one given by the jabber server."
-msgstr ""
+msgstr "Қосулы түрса, jingle қолдану кезде Gajim STUN серверін қолдануға тырысады. Ол сервер \"stun_server\" опциясында көрсетіледі не оны jabber сервердің өзі береді."
#: ../src/common/config.py:285
msgid "STUN server to use when using jingle"
@@ -3774,15 +3780,15 @@
#: ../src/common/config.py:286
msgid "If True, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon"
-msgstr ""
+msgstr "Қосулы тұрса, топ чаттарындағы қатысушылардың қатысу деңгейін көрсету үшін, Gajim күй таңбашаларына кішкене ғана түсті шаршы қосады"
#: ../src/common/config.py:299
msgid "Priority will change automatically according to your status. Priorities are defined in autopriority_* options."
-msgstr ""
+msgstr "Приоритет күйіңізге сәйкес автоөзгертіледі. Приоритеттер autopriority_* опцияларында бапталған."
#: ../src/common/config.py:307
msgid "Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled"
-msgstr ""
+msgstr "Қайта автоқосылу үшін қолданылатын күйі. Келесіден біреу: желіде, чатқа дайын, кетіп қалған, кеңейтілген кетіп қалған, мазамды алмаңыз, жасырын. ЕСКЕРТУ: бұл опция тек restore_last_status опциясы сөндірілген болса ғана қолданылады"
#: ../src/common/config.py:308
msgid "If enabled, restore the last status that was used."
@@ -3798,7 +3804,7 @@
changeset e1030bbfceee in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=e1030bbfceee
description: prevent gtk warning when adding rows while treeview has no model
diffstat:
src/roster_window.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diffs (21 lines):
diff -r 0a58d024923e -r e1030bbfceee src/roster_window.py
--- a/src/roster_window.py Sat Jul 24 00:22:23 2010 +0200
+++ b/src/roster_window.py Sat Jul 24 00:29:20 2010 +0200
@@ -1428,6 +1428,8 @@
"""
Expand/collapse account row based on self.collapsed_rows
"""
+ if not self.tree.get_model():
+ return
iterA = self._get_account_iter(account)
if not iterA:
# thank you modelfilter
@@ -1444,6 +1446,8 @@
"""
Expand/collapse group row based on self.collapsed_rows
"""
+ if not self.tree.get_model():
+ return
iterG = self._get_group_iter(group, account)
if not iterG:
# Group not visible
changeset 5a7ff360e557 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=5a7ff360e557
description: implement roster iter cache to speed iter search.
diffstat:
src/roster_window.py | 181 ++++++++++++++++++++++++--------------------------
1 files changed, 86 insertions(+), 95 deletions(-)
diffs (truncated from 306 to 300 lines):
diff -r 3c932e59075b -r 5a7ff360e557 src/roster_window.py
--- a/src/roster_window.py Thu Jul 22 22:09:11 2010 +0200
+++ b/src/roster_window.py Sat Jul 24 00:12:16 2010 +0200
@@ -98,43 +98,50 @@
name -- the account name
model -- the data model (default TreeFilterModel)
"""
- if not model:
+ if model is None:
model = self.modelfilter
- if model is None:
- return
- account_iter = model.get_iter_root()
+ if model is None:
+ return
+
if self.regroup:
- return account_iter
- while account_iter:
- account_name = model[account_iter][C_ACCOUNT]
- if account_name and name == account_name.decode('utf-8'):
- break
- account_iter = model.iter_next(account_iter)
- return account_iter
-
-
- def _get_group_iter(self, name, account, account_iter=None, model=None):
+ if 'account' not in self._iters:
+ return None
+ it = self._iters['account']
+ else:
+ it = self._iters[name]['account']
+
+ if model == self.model or it is None:
+ return it
+ try:
+ return self.modelfilter.convert_child_iter_to_iter(it)
+ except RuntimeError:
+ return None
+
+
+ def _get_group_iter(self, name, account, model=None):
"""
Return the gtk.TreeIter of the given group or None if not found
Keyword arguments:
name -- the group name
account -- the account name
- account_iter -- the iter of the account the model (default None)
model -- the data model (default TreeFilterModel)
"""
- if not model:
+ if model is None:
model = self.modelfilter
- if not account_iter:
- account_iter = self._get_account_iter(account, model)
- group_iter = model.iter_children(account_iter)
- # C_NAME column contacts the pango escaped group name
- while group_iter:
- group_name = model[group_iter][C_JID].decode('utf-8')
- if name == group_name:
- break
- group_iter = model.iter_next(group_iter)
- return group_iter
+ if model is None:
+ return
+
+ if name not in self._iters[account]['groups']:
+ return None
+
+ it = self._iters[account]['groups'][name]
+ if model == self.model or it is None:
+ return it
+ try:
+ return self.modelfilter.convert_child_iter_to_iter(it)
+ except RuntimeError:
+ return None
def _get_self_contact_iter(self, account, model=None):
@@ -145,19 +152,10 @@
account -- the account of SelfContact
model -- the data model (default TreeFilterModel)
"""
- if not model:
- model = self.modelfilter
- iterAcct = self._get_account_iter(account, model)
- iterC = model.iter_children(iterAcct)
-
- # There might be several SelfContacts in merged account view
- while iterC:
- if model[iterC][C_TYPE] != 'self_contact':
- break
- iter_account = model[iterC][C_ACCOUNT]
- if account == iter_account.decode('utf-8'):
- return iterC
- iterC = model.iter_next(iterC)
+ jid = gajim.get_jid_from_account(account)
+ its = self._get_contact_iter(jid, account, model=model)
+ if its:
+ return its[0]
return None
@@ -171,61 +169,36 @@
contact -- the contact (default None)
model -- the data model (default TreeFilterModel)
"""
- if not model:
+ if model is None:
model = self.modelfilter
# when closing Gajim model can be none (async pbs?)
if model is None:
return []
- if jid == gajim.get_jid_from_account(account):
- contact_iter = self._get_self_contact_iter(account, model)
- if contact_iter:
- return [contact_iter]
- else:
- return []
-
if not contact:
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
if not contact:
# We don't know this contact
return []
- acct = self._get_account_iter(account, model)
- found = [] # the contact iters. One per group
- for group in contact.get_shown_groups():
- group_iter = self._get_group_iter(group, account, acct, model)
- contact_iter = model.iter_children(group_iter)
-
- while contact_iter:
- # Loop over all contacts in this group
- iter_jid = model[contact_iter][C_JID]
- if iter_jid and jid == iter_jid.decode('utf-8') and \
- account == model[contact_iter][C_ACCOUNT].decode('utf-8'):
- # only one iter per group
- found.append(contact_iter)
- contact_iter = None
- elif model.iter_has_child(contact_iter):
- # it's a big brother and has children
- contact_iter = model.iter_children(contact_iter)
- else:
- # try to find next contact:
- # other contact in this group or
- # brother contact
- next_contact_iter = model.iter_next(contact_iter)
- if next_contact_iter:
- contact_iter = next_contact_iter
- else:
- # It's the last one.
- # Go up if we are big brother
- parent_iter = model.iter_parent(contact_iter)
- if parent_iter and model[parent_iter][C_TYPE] == \
- 'contact':
- contact_iter = model.iter_next(parent_iter)
- else:
- # we tested all
- # contacts in this group
- contact_iter = None
- return found
+ if jid not in self._iters[account]['contacts']:
+ return []
+
+ its = self._iters[account]['contacts'][jid]
+
+ if not its:
+ return []
+
+ if model == self.model:
+ return its
+
+ its2 = []
+ for it in its:
+ try:
+ its2.append(self.modelfilter.convert_child_iter_to_iter(it))
+ except RuntimeError:
+ pass
+ return its2
def _iter_is_separator(self, model, titer):
@@ -278,10 +251,11 @@
if self.regroup:
# Merged accounts view
show = helpers.get_global_show()
- self.model.append(None, [
- gajim.interface.jabber_state_images['16'][show],
- _('Merged accounts'), 'account', '', 'all',
- None, None, None, None, None, None])
+ it = self.model.append(None, [
+ gajim.interface.jabber_state_images['16'][show],
+ _('Merged accounts'), 'account', '', 'all', None, None, None,
+ None, None, None])
+ self._iters['account'] = it
else:
show = gajim.SHOW_LIST[gajim.connections[account].connected]
our_jid = gajim.get_jid_from_account(account)
@@ -293,11 +267,11 @@
gtk.STOCK_DIALOG_AUTHENTICATION,
gtk.ICON_SIZE_MENU)
- self.model.append(None, [
- gajim.interface.jabber_state_images['16'][show],
- gobject.markup_escape_text(account), 'account',
- our_jid, account, None, None, None, None, None,
- tls_pixbuf])
+ it = self.model.append(None, [
+ gajim.interface.jabber_state_images['16'][show],
+ gobject.markup_escape_text(account), 'account', our_jid,
+ account, None, None, None, None, None, tls_pixbuf])
+ self._iters[account]['account'] = it
self.draw_account(account)
@@ -362,13 +336,17 @@
contact.get_shown_name(), 'contact', contact.jid, account,
None, None, None, None, None, None))
added_iters.append(it)
+ if contact.jid in self._iters[account]['contacts']:
+ self._iters[account]['contacts'][contact.jid].append(it)
+ else:
+ self._iters[account]['contacts'][contact.jid] = [it]
else:
# We are a normal contact. Add us to our groups.
if not groups:
groups = contact.get_shown_groups()
for group in groups:
child_iterG = self._get_group_iter(group, account,
- model = self.model)
+ model=self.model)
if not child_iterG:
# Group is not yet in roster, add it!
child_iterA = self._get_account_iter(account, self.model)
@@ -378,6 +356,7 @@
'group', group, account, None, None, None, None, None,
None])
self.draw_group(group, account)
+ self._iters[account]['groups'][group] = child_iterG
if contact.is_transport():
typestr = 'agent'
@@ -393,6 +372,10 @@
contact.jid, account, None, None, None,
None, None, None))
added_iters.append(i_)
+ if contact.jid in self._iters[account]['contacts']:
+ self._iters[account]['contacts'][contact.jid].append(i_)
+ else:
+ self._iters[account]['contacts'][contact.jid] = [i_]
# Restore the group expand state
if account + group in self.collapsed_rows:
@@ -455,8 +438,10 @@
if group in gajim.groups[account]:
del gajim.groups[account][group]
self.model.remove(parent_i)
+ del self._iters[account]['groups'][group]
else:
self.model.remove(i)
+ del self._iters[account]['contacts'][contact.jid]
return True
def _add_metacontact_family(self, family, account):
@@ -633,8 +618,9 @@
self.model)) == 0, 'Self contact %s already in roster' % jid
child_iterA = self._get_account_iter(account, self.model)
- self.model.append(child_iterA, (None, gajim.nicks[account],
- 'self_contact', jid, account, None, None, None, None, None, None))
+ self._iters[account]['contacts'][jid] = [self.model.append(child_iterA,
+ (None, gajim.nicks[account], 'self_contact', jid, account, None,
+ None, None, None, None, None))]
self.draw_completely(jid, account)
self.draw_account(account)
@@ -1398,7 +1384,9 @@
self.on_modelfilter_row_has_child_toggled)
self.tree.set_model(self.modelfilter)
+ self._iters = {}
for acct in gajim.contacts.get_accounts():
+ self._iters[acct] = {'account': None, 'groups': {}, 'contacts': {}}
self.add_account(acct)
self.add_account_contacts(acct)
# Recalculate column width for ellipsizing
@@ -1729,6 +1717,8 @@
# Most of the logic SHOULD NOT be done at GUI level
if account not in gajim.contacts.get_accounts():
gajim.contacts.add_account(account)
+ self._iters[account] = {'account': None, 'groups': {},
+ 'contacts': {}}
if account not in gajim.groups:
gajim.groups[account] = {}
if gajim.config.get('show_self_contact') == 'always':
@@ -5854,6 +5844,7 @@
# sel.connect('changed',