Merge local changes

This commit is contained in:
Stephan Erb 2009-10-14 09:39:18 +02:00
commit 8bffd77a05
8 changed files with 92 additions and 10 deletions

View file

@ -1,5 +1,5 @@
AC_INIT([Gajim - A Jabber Instant Messager], AC_INIT([Gajim - A Jabber Instant Messager],
[0.12.5.4-dev],[http://trac.gajim.org/],[gajim]) [0.12.5.5-dev],[http://trac.gajim.org/],[gajim])
AC_PREREQ([2.59]) AC_PREREQ([2.59])
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)

View file

@ -90,11 +90,18 @@ class Config:
'mood_iconset': [ opt_str, DEFAULT_MOOD_ICONSET, '', True ], 'mood_iconset': [ opt_str, DEFAULT_MOOD_ICONSET, '', True ],
'activity_iconset': [ opt_str, DEFAULT_ACTIVITY_ICONSET, '', True ], 'activity_iconset': [ opt_str, DEFAULT_ACTIVITY_ICONSET, '', True ],
'use_transports_iconsets': [ opt_bool, True, '', True ], 'use_transports_iconsets': [ opt_bool, True, '', True ],
'inmsgcolor': [ opt_color, '#a40000', '', True ], 'inmsgcolor': [ opt_color, '#a40000', _('Incoming nickname color.'), True ],
'outmsgcolor': [ opt_color, '#3465a4', '', True ], 'outmsgcolor': [ opt_color, '#3465a4', _('Outgoing nickname color.'), True ],
'statusmsgcolor': [ opt_color, '#73d216', '', True ], 'inmsgtxtcolor': [ opt_color, '', _('Incoming text color.'), True ],
'outmsgtxtcolor': [ opt_color, '#555753', _('Outgoing text color.'), True ],
'statusmsgcolor': [ opt_color, '#4e9a06', _('Status message text color.'), True ],
'markedmsgcolor': [ opt_color, '#ff8080', '', True ], 'markedmsgcolor': [ opt_color, '#ff8080', '', True ],
'urlmsgcolor': [ opt_color, '#204a87', '', True ], 'urlmsgcolor': [ opt_color, '#204a87', '', True ],
'inmsgfont': [ opt_str, '', _('Incoming nickname font.'), True ],
'outmsgfont': [ opt_str, '', _('Outgoing nickname font.'), True ],
'inmsgtxtfont': [ opt_str, '', _('Incoming text font.'), True ],
'outmsgtxtfont': [ opt_str, '', _('Outgoing text font.'), True ],
'statusmsgfont': [ opt_str, '', _('Status message text font.'), True ],
'collapsed_rows': [ opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True ], 'collapsed_rows': [ opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True ],
'roster_theme': [ opt_str, _('default'), '', True ], 'roster_theme': [ opt_str, _('default'), '', True ],
'mergeaccounts': [ opt_bool, False, '', True ], 'mergeaccounts': [ opt_bool, False, '', True ],

View file

@ -39,6 +39,7 @@ import operator
import time import time
import locale import locale
import hmac
try: try:
randomsource = random.SystemRandom() randomsource = random.SystemRandom()
@ -190,6 +191,7 @@ class Connection(ConnectionHandlers):
self.vcard_supported = False self.vcard_supported = False
self.private_storage_supported = True self.private_storage_supported = True
self.streamError = '' self.streamError = ''
self.secret_hmac = str(random.random())[2:]
# END __init__ # END __init__
def put_event(self, ev): def put_event(self, ev):
@ -1775,8 +1777,12 @@ class Connection(ConnectionHandlers):
last_log = 0 last_log = 0
self.last_history_time[room_jid] = last_log self.last_history_time[room_jid] = last_log
p = common.xmpp.Presence(to = '%s/%s' % (room_jid, nick), p = common.xmpp.Presence(to='%s/%s' % (room_jid, nick),
show = show, status = self.status) show=show, status=self.status)
h = hmac.new(self.secret_hmac, room_jid).hexdigest()[:6]
id_ = self.connection.getAnID()
id_ = 'gajim_muc_' + id_ + '_' + h
p.setID(id_)
if gajim.config.get('send_sha_in_gc_presence'): if gajim.config.get('send_sha_in_gc_presence'):
p = self.add_sha(p) p = self.add_sha(p)
self.add_lang(p) self.add_lang(p)
@ -1843,6 +1849,10 @@ class Connection(ConnectionHandlers):
xmpp_show = helpers.get_xmpp_show(show) xmpp_show = helpers.get_xmpp_show(show)
p = common.xmpp.Presence(to = '%s/%s' % (jid, nick), typ = ptype, p = common.xmpp.Presence(to = '%s/%s' % (jid, nick), typ = ptype,
show = xmpp_show, status = status) show = xmpp_show, status = status)
h = hmac.new(self.secret_hmac, jid).hexdigest()[:6]
id_ = self.connection.getAnID()
id_ = 'gajim_muc_' + id_ + '_' + h
p.setID(id_)
if gajim.config.get('send_sha_in_gc_presence') and show != 'offline': if gajim.config.get('send_sha_in_gc_presence') and show != 'offline':
p = self.add_sha(p, ptype != 'unavailable') p = self.add_sha(p, ptype != 'unavailable')
self.add_lang(p) self.add_lang(p)

View file

@ -34,6 +34,7 @@ import socket
import sys import sys
import operator import operator
import hashlib import hashlib
import hmac
from time import (altzone, daylight, gmtime, localtime, mktime, strftime, from time import (altzone, daylight, gmtime, localtime, mktime, strftime,
time as time_time, timezone, tzname) time as time_time, timezone, tzname)
@ -2207,6 +2208,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
return return
jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who) jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
timestamp = None timestamp = None
id_ = prs.getID()
is_gc = False # is it a GC presence ? is_gc = False # is it a GC presence ?
sigTag = None sigTag = None
ns_muc_user_x = None ns_muc_user_x = None
@ -2246,6 +2248,13 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
if self.connection.getRoster().getItem(agent): # to be sure it's a transport contact if self.connection.getRoster().getItem(agent): # to be sure it's a transport contact
transport_auto_auth = True transport_auto_auth = True
if not is_gc and id_ and id_.startswith('gajim_muc_') and \
ptype == 'error':
# Error presences may not include sent stanza, so we don't detect it's
# a muc preence. So detect it by ID
h = hmac.new(self.secret_hmac, jid_stripped).hexdigest()[:6]
if id_.split('_')[-1] == h:
is_gc = True
status = prs.getStatus() or '' status = prs.getStatus() or ''
show = prs.getShow() show = prs.getShow()
if not show in gajim.SHOW_LIST: if not show in gajim.SHOW_LIST:
@ -2273,6 +2282,17 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
errmsg = prs.getErrorMsg() errmsg = prs.getErrorMsg()
errcode = prs.getErrorCode() errcode = prs.getErrorCode()
room_jid, nick = gajim.get_room_and_nick_from_fjid(who) room_jid, nick = gajim.get_room_and_nick_from_fjid(who)
gc_control = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
self.name)
# If gc_control is missing - it may be minimized. Try to get it from
# there. If it's not there - then it's missing anyway and will
# remain set to None.
if gc_control is None:
minimized = gajim.interface.minimized_controls[self.name]
gc_control = minimized.get(room_jid)
if errcode == '502': if errcode == '502':
# Internal Timeout: # Internal Timeout:
self.dispatch('NOTIFY', (jid_stripped, 'error', errmsg, resource, self.dispatch('NOTIFY', (jid_stripped, 'error', errmsg, resource,
@ -2290,9 +2310,10 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
self.dispatch('ERROR', (_('Unable to join group chat'), self.dispatch('ERROR', (_('Unable to join group chat'),
_('You are banned from group chat %s.') % room_jid)) _('You are banned from group chat %s.') % room_jid))
elif (errcode == '404') or (errcon == 'item-not-found'): elif (errcode == '404') or (errcon == 'item-not-found'):
# group chat does not exist if gc_control is None or gc_control.autorejoin is None:
self.dispatch('ERROR', (_('Unable to join group chat'), # group chat does not exist
_('Group chat %s does not exist.') % room_jid)) self.dispatch('ERROR', (_('Unable to join group chat'),
_('Group chat %s does not exist.') % room_jid))
elif (errcode == '405') or (errcon == 'not-allowed'): elif (errcode == '405') or (errcon == 'not-allowed'):
self.dispatch('ERROR', (_('Unable to join group chat'), self.dispatch('ERROR', (_('Unable to join group chat'),
_('Group chat creation is restricted.'))) _('Group chat creation is restricted.')))

View file

@ -27,7 +27,7 @@ docdir = '../'
datadir = '../' datadir = '../'
localedir = '../po' localedir = '../po'
version = '0.12.5.4-dev' version = '0.12.5.5-dev'
import sys, os.path import sys, os.path
for base in ('.', 'common'): for base in ('.', 'common'):

View file

@ -208,6 +208,8 @@ class OptionsParser:
self.update_config_to_01253() self.update_config_to_01253()
if old < [0, 12, 5, 4] and new >= [0, 12, 5, 4]: if old < [0, 12, 5, 4] and new >= [0, 12, 5, 4]:
self.update_config_to_01254() self.update_config_to_01254()
if old < [0, 12, 5, 5] and new >= [0, 12, 5, 5]:
self.update_config_to_01255()
gajim.logger.init_vars() gajim.logger.init_vars()
gajim.config.set('version', new_version) gajim.config.set('version', new_version)
@ -758,10 +760,24 @@ class OptionsParser:
'urlmsgcolor': ['#0000ff', '#204a87'], 'urlmsgcolor': ['#0000ff', '#204a87'],
'gc_nicknames_colors': ['#a34526:#c000ff:#0012ff:#388a99:#045723:#7c7c7c:#ff8a00:#94452d:#244b5a:#32645a', '#4e9a06:#f57900:#ce5c00:#3465a4:#204a87:#75507b:#5c3566:#c17d11:#8f5902:#ef2929:#cc0000:#a40000']} 'gc_nicknames_colors': ['#a34526:#c000ff:#0012ff:#388a99:#045723:#7c7c7c:#ff8a00:#94452d:#244b5a:#32645a', '#4e9a06:#f57900:#ce5c00:#3465a4:#204a87:#75507b:#5c3566:#c17d11:#8f5902:#ef2929:#cc0000:#a40000']}
for c in vals: for c in vals:
if c not in self.old_values:
continue
val = self.old_values[c] val = self.old_values[c]
if val == vals[c][0]: if val == vals[c][0]:
# We didn't change default value, so update it with new default # We didn't change default value, so update it with new default
gajim.config.set(c, vals[c][1]) gajim.config.set(c, vals[c][1])
gajim.config.set('version', '0.12.5.4') gajim.config.set('version', '0.12.5.4')
def update_config_to_01255(self):
vals = {'statusmsgcolor': ['#73d216', '#4e9a06'],
'outmsgtxtcolor': ['#a2a2a2', '#555753']}
for c in vals:
if c not in self.old_values:
continue
val = self.old_values[c]
if val == vals[c][0]:
# We didn't change default value, so update it with new default
gajim.config.set(c, vals[c][1])
gajim.config.set('version', '0.12.5.5')
# vim: se ts=3: # vim: se ts=3:

View file

@ -230,13 +230,35 @@ class ConversationTextview(gobject.GObject):
self.tagIn = buffer_.create_tag('incoming') self.tagIn = buffer_.create_tag('incoming')
color = gajim.config.get('inmsgcolor') color = gajim.config.get('inmsgcolor')
font = pango.FontDescription(gajim.config.get('inmsgfont'))
self.tagIn.set_property('foreground', color) self.tagIn.set_property('foreground', color)
self.tagIn.set_property('font-desc', font)
self.tagOut = buffer_.create_tag('outgoing') self.tagOut = buffer_.create_tag('outgoing')
color = gajim.config.get('outmsgcolor') color = gajim.config.get('outmsgcolor')
font = pango.FontDescription(gajim.config.get('outmsgfont'))
self.tagOut.set_property('foreground', color) self.tagOut.set_property('foreground', color)
self.tagOut.set_property('font-desc', font)
self.tagStatus = buffer_.create_tag('status') self.tagStatus = buffer_.create_tag('status')
color = gajim.config.get('statusmsgcolor') color = gajim.config.get('statusmsgcolor')
font = pango.FontDescription(gajim.config.get('satusmsgfont'))
self.tagStatus.set_property('foreground', color) self.tagStatus.set_property('foreground', color)
self.tagStatus.set_property('font-desc', font)
self.tagInText = buffer_.create_tag('incomingtxt')
color = gajim.config.get('inmsgtxtcolor')
font = pango.FontDescription(gajim.config.get('inmsgtxtfont'))
if color:
self.tagInText.set_property('foreground', color)
self.tagInText.set_property('font-desc', font)
self.tagOutText = buffer_.create_tag('outgoingtxt')
color = gajim.config.get('outmsgtxtcolor')
if color:
font = pango.FontDescription(gajim.config.get('outmsgtxtfont'))
self.tagOutText.set_property('foreground', color)
self.tagOutText.set_property('font-desc', font)
colors = gajim.config.get('gc_nicknames_colors') colors = gajim.config.get('gc_nicknames_colors')
colors = colors.split(':') colors = colors.split(':')
@ -1219,6 +1241,10 @@ class ConversationTextview(gobject.GObject):
'chat_merge_consecutive_nickname_indent')) 'chat_merge_consecutive_nickname_indent'))
else: else:
self.print_name(name, kind, other_tags_for_name) self.print_name(name, kind, other_tags_for_name)
if kind == 'incoming':
text_tags.append('incomingtxt')
elif kind == 'outgoing':
text_tags.append('outgoingtxt')
self.print_subject(subject) self.print_subject(subject)
self.print_real_text(text, text_tags, name, xhtml, graphics=graphics) self.print_real_text(text, text_tags, name, xhtml, graphics=graphics)

View file

@ -409,6 +409,7 @@ class HistoryWindow:
constants.KIND_CHAT_MSG_RECV): constants.KIND_CHAT_MSG_RECV):
contact_name = self.completion_dict[self.jid][C_INFO_NAME] contact_name = self.completion_dict[self.jid][C_INFO_NAME]
tag_name = 'incoming' tag_name = 'incoming'
tag_msg = 'incomingtxt'
elif kind in (constants.KIND_SINGLE_MSG_SENT, elif kind in (constants.KIND_SINGLE_MSG_SENT,
constants.KIND_CHAT_MSG_SENT): constants.KIND_CHAT_MSG_SENT):
if self.account: if self.account:
@ -419,6 +420,7 @@ class HistoryWindow:
account = gajim.contacts.get_accounts()[0] account = gajim.contacts.get_accounts()[0]
contact_name = gajim.nicks[account] contact_name = gajim.nicks[account]
tag_name = 'outgoing' tag_name = 'outgoing'
tag_msg = 'outgoingtxt'
elif kind == constants.KIND_GCSTATUS: elif kind == constants.KIND_GCSTATUS:
# message here (if not None) is status message # message here (if not None) is status message
if message: if message: