Philipp Hörist pushed to branch master at gajim / gajim
Commits:
a3e63057 by Philipp Hörist at 2019-08-25T08:23:33Z
Avatar: Check storage before vcard request
- - - - -
1 changed file:
- gajim/common/modules/vcard_avatars.py
Changes:
=====================================
gajim/common/modules/vcard_avatars.py
=====================================
@@ -14,7 +14,6 @@
# XEP-0153: vCard-Based Avatars
-import os
from pathlib import Path
import nbxmpp
@@ -113,6 +112,7 @@ class VCardAvatars(BaseModule):
def _update_received(self, properties, room=False):
jid = properties.jid.getBare()
+ acc_jid = self._con.get_own_jid().getStripped()
if properties.avatar_state == AvatarState.EMPTY:
# Empty <photo/> tag, means no avatar is advertised
self._log.info('%s has no avatar published', properties.jid)
@@ -120,8 +120,10 @@ class VCardAvatars(BaseModule):
# Remove avatar
self._log.debug('Remove: %s', jid)
app.contacts.set_avatar(self._account, jid, None)
- acc_jid = self._con.get_own_jid().getStripped()
- if not room:
+
+ if room:
+ app.logger.set_muc_avatar_sha(jid, None)
+ else:
app.logger.set_avatar_sha(acc_jid, jid, None)
app.interface.update_avatar(
self._account, jid, room_avatar=room)
@@ -135,16 +137,21 @@ class VCardAvatars(BaseModule):
jid, properties.avatar_sha)
return
- if room:
- # We dont save the room avatar hash in our DB, so check
- # if we previously downloaded it
- if app.interface.avatar_exists(properties.avatar_sha):
- app.contacts.set_avatar(self._account,
- jid,
- properties.avatar_sha)
- app.interface.update_avatar(
- self._account, jid, room_avatar=room)
- return
+ if app.interface.avatar_exists(properties.avatar_sha):
+ # Check if the avatar is already in storage
+ self._log.info('Found avatar in storage')
+ if room:
+ app.logger.set_muc_avatar_sha(jid, properties.avatar_sha)
+ else:
+ app.logger.set_avatar_sha(acc_jid,
+ jid,
+ properties.avatar_sha)
+ app.contacts.set_avatar(self._account,
+ jid,
+ properties.avatar_sha)
+ app.interface.update_avatar(
+ self._account, jid, room_avatar=room)
+ return
if properties.avatar_sha not in self._requested_shas:
self._requested_shas.append(properties.avatar_sha)
@@ -173,9 +180,7 @@ class VCardAvatars(BaseModule):
app.interface.update_avatar(contact=gc_contact)
else:
self._log.info('Update: %s %s', nick, properties.avatar_sha)
- path = os.path.join(configpaths.get('AVATAR'),
- properties.avatar_sha)
- if not os.path.isfile(path):
+ if not app.interface.avatar_exists(properties.avatar_sha):
if properties.avatar_sha not in self._requested_shas:
app.log('avatar').info('Request: %s', nick)
self._requested_shas.append(properties.avatar_sha)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/a3e63057ece9a6e12f3e072adda0b9f010…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/a3e63057ece9a6e12f3e072adda0b9f010…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
8416724b by Daniel Brötzmann at 2019-08-24T21:53:33Z
HistorySync: Fix some strings
- - - - -
1 changed file:
- gajim/gtk/history_sync.py
Changes:
=====================================
gajim/gtk/history_sync.py
=====================================
@@ -206,7 +206,7 @@ class SelectTimePage(Gtk.Box):
self.set_spacing(18)
self.assistant = assistant
label = Gtk.Label(
- label=_('How far back do you want to synchronize chat history?'))
+ label=_('How far back should the chat history be synchronised?'))
listbox = Gtk.ListBox()
listbox.set_hexpand(False)
@@ -258,7 +258,7 @@ class DownloadHistoryPage(Gtk.Box):
'received': self.received, 'max': self.count}))
else:
self.progress.pulse()
- self.progress.set_text(_('Downloaded %s Messages' % self.received))
+ self.progress.set_text(_('Downloaded %s messages' % self.received))
def finished(self):
self.progress.set_fraction(1)
@@ -278,25 +278,15 @@ class SummaryPage(Gtk.Box):
def finished(self):
received = self.assistant.download_history.received
- finished = _('''
- Finished synchronising your History.
- {received} Messages downloaded.
- '''.format(received=received))
- self.label.set_text(finished)
+ self.label.set_text(_('Finished synchronising chat history:\n'
+ '%s messages downloaded' % received))
def nothing_to_do(self):
- nothing_to_do = _('''
- Gajim is fully synchronised
- with the Archive.
- ''')
- self.label.set_text(nothing_to_do)
+ self.label.set_text(_('Gajim is fully synchronised with the archive.'))
def query_already_running(self):
- already_running = _('''
- There is already a synchronisation in
- progress. Please try later.
- ''')
- self.label.set_text(already_running)
+ self.label.set_text(_('There is already a synchronisation in '
+ 'progress. Please try again later.'))
class TimeOption(Gtk.Label):
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/8416724b3a58792d3daa044084d31039b8…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/8416724b3a58792d3daa044084d31039b8…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
07401332 by Philipp Hörist at 2019-08-22T22:22:06Z
HTTPUpload: Allow max_file_size to be a float
- - - - -
1 changed file:
- gajim/common/modules/httpupload.py
Changes:
=====================================
gajim/common/modules/httpupload.py
=====================================
@@ -89,7 +89,11 @@ class HTTPUpload(BaseModule):
continue
size = form.vars.get('max-file-size')
if size is not None:
- self.max_file_size = int(size.value)
+ try:
+ self.max_file_size = float(size.value)
+ except Exception:
+ self._log.info('Invalid file size: %s', size.value)
+ size = None
break
if self.max_file_size is None:
@@ -205,7 +209,7 @@ class HTTPUpload(BaseModule):
tmp = stanza.getTag('error').getTag('file-too-large')
if tmp is not None:
- max_file_size = int(tmp.getTag('max-file-size').getData())
+ max_file_size = float(tmp.getTag('max-file-size').getData())
return _('File is too large, maximum allowed file size is: %s') % \
GLib.format_size_full(max_file_size,
GLib.FormatSizeFlags.IEC_UNITS)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0740133237997da9312aa5b13c70eff234…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0740133237997da9312aa5b13c70eff234…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0ebc5171 by Philipp Hörist at 2019-08-22T18:23:11Z
Bookmarks: Check if there was a change before store
- - - - -
1 changed file:
- gajim/common/modules/bookmarks.py
Changes:
=====================================
gajim/common/modules/bookmarks.py
=====================================
@@ -200,13 +200,17 @@ class Bookmarks(BaseModule):
bookmark = self.get_bookmark_from_jid(jid)
if bookmark is None:
bookmark = BookmarkData(jid=jid, **kwargs)
+ self._bookmarks.append(bookmark)
self._log.info('Add new bookmark: %s', bookmark)
else:
+ modified_bookmark = bookmark._replace(**kwargs)
+ if modified_bookmark == bookmark:
+ # No change happened
+ return
self._log.info('Modify bookmark: %s %s', jid, kwargs)
self._bookmarks.remove(bookmark)
- bookmark = bookmark._replace(**kwargs)
+ self._bookmarks.append(modified_bookmark)
- self._bookmarks.append(bookmark)
self.store_bookmarks()
def remove(self, jid: str, publish: bool = True) -> None:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0ebc51714c156832531bb1b9f4ab44db65…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0ebc51714c156832531bb1b9f4ab44db65…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
e4aec8dc by Philipp Hörist at 2019-08-21T21:14:48Z
Fix undefined variable
- - - - -
1 changed file:
- gajim/groupchat_control.py
Changes:
=====================================
gajim/groupchat_control.py
=====================================
@@ -1702,7 +1702,7 @@ class GroupchatControl(ChatControlBase):
self.add_info_message(_('A new group chat has been created'))
@event_filter(['account', 'room_jid'])
- def _on_configuration_failed(self, _event):
+ def _on_configuration_failed(self, event):
self.xml.error_label.set_text(to_user_string(event.error))
self._show_page('error')
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/e4aec8dca88bc6bd471666779697459960…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/e4aec8dca88bc6bd471666779697459960…
You're receiving this email because of your account on dev.gajim.org.