emoticons and status messages are now a group of ption in the common config file (thx tab for your code)
This commit is contained in:
parent
c981ac6b00
commit
04db394f87
|
@ -33,32 +33,22 @@ class Config:
|
|||
|
||||
__options = {
|
||||
# name: [ type, value ]
|
||||
'log': [ opt_bool, 'True' ],
|
||||
'delauth': [ opt_bool, 'True' ],
|
||||
'delroster': [ opt_bool, 'True' ],
|
||||
'alwaysauth': [ opt_bool, 'False' ],
|
||||
'autopopup': [ opt_bool, 'False' ],
|
||||
'autopopupaway': [ opt_bool, 'False' ],
|
||||
'ignore_unknown_contacts': [ opt_bool, 'False' ],
|
||||
'showoffline': [ opt_bool, 'False' ],
|
||||
'autoaway': [ opt_bool, 'True' ],
|
||||
'log': [ opt_bool, True ],
|
||||
'delauth': [ opt_bool, True ],
|
||||
'delroster': [ opt_bool, True ],
|
||||
'alwaysauth': [ opt_bool, False ],
|
||||
'autopopup': [ opt_bool, False ],
|
||||
'autopopupaway': [ opt_bool, False ],
|
||||
'ignore_unknown_contacts': [ opt_bool, False ],
|
||||
'showoffline': [ opt_bool, False ],
|
||||
'autoaway': [ opt_bool, True ],
|
||||
'autoawaytime': [ opt_int, 10 ],
|
||||
'autoxa': [ opt_bool, 'True' ],
|
||||
'autoxa': [ opt_bool, True ],
|
||||
'autoxatime': [ opt_int, 20 ],
|
||||
'ask_online_status': [ opt_bool, 'False' ],
|
||||
'ask_offline_status': [ opt_bool, 'False' ],
|
||||
'ask_online_status': [ opt_bool, False ],
|
||||
'ask_offline_status': [ opt_bool, False ],
|
||||
'last_msg': [ opt_str, '' ],
|
||||
'msg0_name': [ opt_str, 'Nap' ],
|
||||
'msg0': [ opt_str, 'I\'m taking a nap.' ],
|
||||
'msg1_name': [ opt_str, 'Brb' ],
|
||||
'msg1': [ opt_str, 'Back in some minutes.' ],
|
||||
'msg2_name': [ opt_str, 'Eating' ],
|
||||
'msg2': [ opt_str, 'I\'m eating, so leave me a message.' ],
|
||||
'msg3_name': [ opt_str, 'Movie' ],
|
||||
'msg3': [ opt_str, 'I\'m watching a movie.' ],
|
||||
'msg4_name': [ opt_str, 'Working' ],
|
||||
'msg4': [ opt_str, 'I\'m working.' ],
|
||||
'trayicon': [ opt_bool, 'True' ],
|
||||
'trayicon': [ opt_bool, True ],
|
||||
'iconset': [ opt_str, 'sun' ],
|
||||
'inmsgcolor': [ opt_color, '#ff0000' ],
|
||||
'outmsgcolor': [ opt_color, '#0000ff' ],
|
||||
|
@ -73,24 +63,13 @@ class Config:
|
|||
'usertextcolor': [ opt_color, '#000000' ],
|
||||
'userbgcolor': [ opt_color, '#ffffff' ],
|
||||
'userfont': [ opt_str, 'Sans 10' ],
|
||||
'saveposition': [ opt_bool, 'True' ],
|
||||
'mergeaccounts': [ opt_bool, 'False' ],
|
||||
'usetabbedchat': [ opt_bool, 'True' ],
|
||||
'saveposition': [ opt_bool, True ],
|
||||
'mergeaccounts': [ opt_bool, False ],
|
||||
'usetabbedchat': [ opt_bool, True ],
|
||||
'print_time': [ opt_str, 'always' ],
|
||||
'useemoticons': [ opt_bool, 'True' ],
|
||||
'emoticons': [ opt_str, ':-)\tplugins/gtkgui/emoticons/smile.png\t(@)\tplugins/gtkgui/emoticons/pussy.png\t8)\tplugins/gtkgui/emoticons/coolglasses.png\t:(\tplugins/gtkgui/emoticons/unhappy.png\t:)\tplugins/gtkgui/emoticons/smile.png\t(})\tplugins/gtkgui/emoticons/hugleft.png\t:$\tplugins/gtkgui/emoticons/blush.png\t(Y)\tplugins/gtkgui/emoticons/yes.png\t:-@\tplugins/gtkgui/emoticons/angry.png\t:-D\tplugins/gtkgui/emoticons/biggrin.png\t(U)\tplugins/gtkgui/emoticons/brheart.png\t(F)\tplugins/gtkgui/emoticons/flower.png\t:-[\tplugins/gtkgui/emoticons/bat.png\t:>\tplugins/gtkgui/emoticons/biggrin.png\t(T)\tplugins/gtkgui/emoticons/phone.png\t:-S\tplugins/gtkgui/emoticons/frowing.png\t:-P\tplugins/gtkgui/emoticons/tongue.png\t(H)\tplugins/gtkgui/emoticons/coolglasses.png\t(D)\tplugins/gtkgui/emoticons/drink.png\t:-O\tplugins/gtkgui/emoticons/oh.png\t(C)\tplugins/gtkgui/emoticons/coffee.png\t({)\tplugins/gtkgui/emoticons/hugright.png\t(*)\tplugins/gtkgui/emoticons/star.png\tB-)\tplugins/gtkgui/emoticons/coolglasses.png\t(Z)\tplugins/gtkgui/emoticons/boy.png\t(E)\tplugins/gtkgui/emoticons/mail.png\t(N)\tplugins/gtkgui/emoticons/no.png\t(P)\tplugins/gtkgui/emoticons/photo.png\t(K)\tplugins/gtkgui/emoticons/kiss.png\t(R)\tplugins/gtkgui/emoticons/rainbow.png\t:-|\tplugins/gtkgui/emoticons/stare.png\t;-)\tplugins/gtkgui/emoticons/wink.png\t;-(\tplugins/gtkgui/emoticons/cry.png\t(6)\tplugins/gtkgui/emoticons/devil.png\t(L)\tplugins/gtkgui/emoticons/heart.png\t(W)\tplugins/gtkgui/emoticons/brflower.png\t:|\tplugins/gtkgui/emoticons/stare.png\t:O\tplugins/gtkgui/emoticons/oh.png\t;)\tplugins/gtkgui/emoticons/wink.png\t;(\tplugins/gtkgui/emoticons/cry.png\t:S\tplugins/gtkgui/emoticons/frowing.png\t;\'-(\tplugins/gtkgui/emoticons/cry.png\t:-(\tplugins/gtkgui/emoticons/unhappy.png\t8-)\tplugins/gtkgui/emoticons/coolglasses.png\t(B)\tplugins/gtkgui/emoticons/beer.png\t:D\tplugins/gtkgui/emoticons/biggrin.png\t(8)\tplugins/gtkgui/emoticons/music.png\t:@\tplugins/gtkgui/emoticons/angry.png\tB)\tplugins/gtkgui/emoticons/coolglasses.png\t:-$\tplugins/gtkgui/emoticons/blush.png\t:\'(\tplugins/gtkgui/emoticons/cry.png\t:->\tplugins/gtkgui/emoticons/biggrin.png\t:[\tplugins/gtkgui/emoticons/bat.png\t(I)\tplugins/gtkgui/emoticons/lamp.png\t:P\tplugins/gtkgui/emoticons/tongue.png\t(%)\tplugins/gtkgui/emoticons/cuffs.png\t(S)\tplugins/gtkgui/emoticons/moon.png' ],
|
||||
'sounds_on': [ opt_bool, 'True' ],
|
||||
'useemoticons': [ opt_bool, True ],
|
||||
'sounds_on': [ opt_bool, True ],
|
||||
'soundplayer': [ opt_str, 'play' ],
|
||||
'sound_first_message_received': [ opt_bool, 'True' ],
|
||||
'sound_first_message_received_file': [ opt_str, 'sounds/message1.wav' ],
|
||||
'sound_next_message_received': [ opt_bool, 'True' ],
|
||||
'sound_next_message_received_file': [ opt_str, 'sounds/message2.wav' ],
|
||||
'sound_contact_connected': [ opt_bool, 'True' ],
|
||||
'sound_contact_connected_file': [ opt_str, 'sounds/connected.wav' ],
|
||||
'sound_contact_disconnected': [ opt_bool, 'True' ],
|
||||
'sound_contact_disconnected_file': [ opt_str, 'sounds/disconnected.wav' ],
|
||||
'sound_message_sent': [ opt_bool, 'True' ],
|
||||
'sound_message_sent_file': [ opt_str, 'sounds/sent.wav' ],
|
||||
'openwith': [ opt_str, 'gnome-open' ],
|
||||
'custombrowser': [ opt_str, 'firefox' ],
|
||||
'custommailapp': [ opt_str, 'mozilla-thunderbird -compose' ],
|
||||
|
@ -104,36 +83,119 @@ class Config:
|
|||
'after_time': [ opt_str, ']' ],
|
||||
'before_nickname': [ opt_str, '<' ],
|
||||
'after_nickname': [ opt_str, '>' ],
|
||||
'do_not_send_os_info': [ opt_bool, 'False' ],
|
||||
'usegpg': [ opt_bool, 'False' ],
|
||||
'lognotusr': [ opt_bool, 'True' ],
|
||||
'lognotsep': [ opt_bool, 'True' ],
|
||||
'do_not_send_os_info': [ opt_bool, False ],
|
||||
'usegpg': [ opt_bool, False ],
|
||||
'lognotusr': [ opt_bool, True ],
|
||||
'lognotsep': [ opt_bool, True ],
|
||||
}
|
||||
|
||||
__options_per_key = {
|
||||
'accounts': ({
|
||||
'name': [ opt_str, '' ],
|
||||
'hostname': [ opt_str, '' ],
|
||||
'savepass': [ opt_bool, 'False' ],
|
||||
'name': [ opt_str, '' ],
|
||||
'hostname': [ opt_str, '' ],
|
||||
'savepass': [ opt_bool, False ],
|
||||
'password': [ opt_str, '' ],
|
||||
'resource': [ opt_str, 'gajim' ],
|
||||
'resource': [ opt_str, 'gajim' ],
|
||||
'priority': [ opt_int, 5 ],
|
||||
'autoconnect': [ opt_bool, 'False' ],
|
||||
'use_proxy': [ opt_bool, 'False' ],
|
||||
'autoconnect': [ opt_bool, False ],
|
||||
'use_proxy': [ opt_bool, False ],
|
||||
'proxyhost': [ opt_str, '' ],
|
||||
'proxyport': [ opt_int, 3128 ],
|
||||
'keyid': [ opt_str, '' ],
|
||||
'keyname': [ opt_str, '' ],
|
||||
'savegpgpass': [ opt_bool, 'False' ],
|
||||
'savegpgpass': [ opt_bool, False ],
|
||||
'gpgpassword': [ opt_str, '' ],
|
||||
'sync_with_global_status': [ opt_bool, 'True' ],
|
||||
'sync_with_global_status': [ opt_bool, True ],
|
||||
'no_log_for': [ opt_str, '' ],
|
||||
}, {}),
|
||||
'statusmsg': ({
|
||||
'message': [ opt_str, '' ],
|
||||
}, {}),
|
||||
'emoticons': ({
|
||||
'path': [ opt_str, '' ],
|
||||
}, {}),
|
||||
'soundevents': ({
|
||||
'enabled': [ opt_bool, True ],
|
||||
'path': [ opt_str, '' ],
|
||||
}, {}),
|
||||
}
|
||||
|
||||
|
||||
emoticons_default = {
|
||||
':-)': 'plugins/gtkgui/emoticons/smile.png',
|
||||
'(@)': 'plugins/gtkgui/emoticons/pussy.png',
|
||||
'8)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||
':(': 'plugins/gtkgui/emoticons/unhappy.png',
|
||||
':)': 'plugins/gtkgui/emoticons/smile.png',
|
||||
'(})': 'plugins/gtkgui/emoticons/hugleft.png',
|
||||
':$': 'plugins/gtkgui/emoticons/blush.png',
|
||||
'(Y)': 'plugins/gtkgui/emoticons/yes.png',
|
||||
':-@': 'plugins/gtkgui/emoticons/angry.png',
|
||||
':-D': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||
'(U)': 'plugins/gtkgui/emoticons/brheart.png',
|
||||
'(F)': 'plugins/gtkgui/emoticons/flower.png',
|
||||
':-[': 'plugins/gtkgui/emoticons/bat.png',
|
||||
':>': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||
'(T)': 'plugins/gtkgui/emoticons/phone.png',
|
||||
':-S': 'plugins/gtkgui/emoticons/frowing.png',
|
||||
':-P': 'plugins/gtkgui/emoticons/tongue.png',
|
||||
'(H)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||
'(D)': 'plugins/gtkgui/emoticons/drink.png',
|
||||
':-O': 'plugins/gtkgui/emoticons/oh.png',
|
||||
'(C)': 'plugins/gtkgui/emoticons/coffee.png',
|
||||
'({)': 'plugins/gtkgui/emoticons/hugright.png',
|
||||
'(*)': 'plugins/gtkgui/emoticons/star.png',
|
||||
'B-)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||
'(Z)': 'plugins/gtkgui/emoticons/boy.png',
|
||||
'(E)': 'plugins/gtkgui/emoticons/mail.png',
|
||||
'(N)': 'plugins/gtkgui/emoticons/no.png',
|
||||
'(P)': 'plugins/gtkgui/emoticons/photo.png',
|
||||
'(K)': 'plugins/gtkgui/emoticons/kiss.png',
|
||||
'(R)': 'plugins/gtkgui/emoticons/rainbow.png',
|
||||
':-|': 'plugins/gtkgui/emoticons/stare.png',
|
||||
';-)': 'plugins/gtkgui/emoticons/wink.png',
|
||||
';-(': 'plugins/gtkgui/emoticons/cry.png',
|
||||
'(6)': 'plugins/gtkgui/emoticons/devil.png',
|
||||
'(L)': 'plugins/gtkgui/emoticons/heart.png',
|
||||
'(W)': 'plugins/gtkgui/emoticons/brflower.png',
|
||||
':|': 'plugins/gtkgui/emoticons/stare.png',
|
||||
':O': 'plugins/gtkgui/emoticons/oh.png',
|
||||
';)': 'plugins/gtkgui/emoticons/wink.png',
|
||||
';(': 'plugins/gtkgui/emoticons/cry.png',
|
||||
':S': 'plugins/gtkgui/emoticons/frowing.png',
|
||||
';\'-(': 'plugins/gtkgui/emoticons/cry.png',
|
||||
':-(': 'plugins/gtkgui/emoticons/unhappy.png',
|
||||
'8-)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||
'(B)': 'plugins/gtkgui/emoticons/beer.png',
|
||||
':D': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||
'(8)': 'plugins/gtkgui/emoticons/music.png',
|
||||
':@': 'plugins/gtkgui/emoticons/angry.png',
|
||||
'B)': 'plugins/gtkgui/emoticons/coolglasses.png',
|
||||
':-$': 'plugins/gtkgui/emoticons/blush.png',
|
||||
':\'(': 'plugins/gtkgui/emoticons/cry.png',
|
||||
':->': 'plugins/gtkgui/emoticons/biggrin.png',
|
||||
':[': 'plugins/gtkgui/emoticons/bat.png',
|
||||
'(I)': 'plugins/gtkgui/emoticons/lamp.png',
|
||||
':P': 'plugins/gtkgui/emoticons/tongue.png',
|
||||
'(%)': 'plugins/gtkgui/emoticons/cuffs.png',
|
||||
'(S)': 'plugins/gtkgui/emoticons/moon.png',
|
||||
}
|
||||
|
||||
statusmsg_default = {
|
||||
'Nap': 'I\'m taking a nap.'
|
||||
'Brb': 'Back in some minutes.'
|
||||
'Eating': 'so leave me a message.'
|
||||
'Movie' : 'I\'m watching a movie.'
|
||||
'Working': 'I\'m working.'
|
||||
}
|
||||
|
||||
soundevents_default = {
|
||||
'first_message_received': [ True, 'sounds/message1.wav' ],
|
||||
'next_message_received': [ True, 'sounds/message2.wav' ],
|
||||
'contact_connected': [ True, 'sounds/connected.wav' ],
|
||||
'contact_disconnected': [ True, 'sounds/disconnected.wav' ],
|
||||
'message_sent': [ True, 'sounds/sent.wav' ],
|
||||
}
|
||||
|
||||
def foreach(self, func):
|
||||
for opt in self.__options:
|
||||
func(opt, None, self.__options[opt])
|
||||
|
@ -157,8 +219,6 @@ class Config:
|
|||
if int(val) == 0 or int(val) == 1:
|
||||
return 1
|
||||
return 0
|
||||
if val == 'True' or val == 'False':
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def is_valid_string(self, val):
|
||||
|
@ -186,16 +246,9 @@ class Config:
|
|||
return 0
|
||||
|
||||
def get(self, optname):
|
||||
if not self.exist(optname):
|
||||
if not self.__options.has_key(optname):
|
||||
return None
|
||||
opt = self.__options[optname]
|
||||
if opt[OPT_TYPE] == opt_bool:
|
||||
if opt[OPT_VAL] == 'False': return False
|
||||
return True
|
||||
elif opt[OPT_TYPE] == opt_int:
|
||||
return int(opt[OPT_VAL])
|
||||
else:
|
||||
return opt[OPT_VAL]
|
||||
return self.__options[optname][OPT_VAL]
|
||||
|
||||
def add_per(self, typename, name):
|
||||
if not self.__options_per_key.has_key(typename):
|
||||
|
@ -245,8 +298,17 @@ class Config:
|
|||
return None
|
||||
return obj[subname][OPT_VAL]
|
||||
|
||||
def exist(self, optname):
|
||||
return self.__options.has_key(optname)
|
||||
|
||||
def __init__(self):
|
||||
#init default values
|
||||
for event in soundevents_default:
|
||||
default = soundevents_default[o]
|
||||
config.add_per('soundevents', event)
|
||||
config.set_per('soundevents', event, 'enable', default[0])
|
||||
config.set_per('soundevents', event, 'path', default[1])
|
||||
for emot in emoticons_default:
|
||||
config.add_per('emoticons', emot)
|
||||
config.set_per('emoticons', emot, 'path', emoticons_default[emot])
|
||||
for msg in statusmsg_default:
|
||||
config.add_per('statusmsg', msg)
|
||||
config.set_per('statusmsg', msg, 'message', statusmsg_default[msg])
|
||||
return
|
||||
|
|
|
@ -390,17 +390,13 @@ class Preferences_window:
|
|||
self.on_checkbutton_toggled(widget, 'ask_offline_status')
|
||||
|
||||
def on_sounds_treemodel_row_changed(self, model, path, iter):
|
||||
iter = model.get_iter_first()
|
||||
while iter:
|
||||
path = model.get_path(iter)
|
||||
sound_event = model.get_value(iter, 0)
|
||||
if model[path][1]:
|
||||
gajim.config.set('sound_' + sound_event, True)
|
||||
else:
|
||||
gajim.config.set('sound_' + sound_event, False)
|
||||
gajim.config.set('sound_' + sound_event + '_file', \
|
||||
model.get_value(iter, 2))
|
||||
iter = model.iter_next(iter)
|
||||
sound_event = model.get_value(iter, 0)
|
||||
if model[path][1]:
|
||||
gajim.config.set_per('soundevents', sound_event, 'enabled', True)
|
||||
else:
|
||||
gajim.config.set_per('soundevents', sound_event, 'enabled', False)
|
||||
gajim.config.set_per('soundevents', sound_event, 'path', \
|
||||
model.get_value(iter, 2))
|
||||
self.plugin.save_config()
|
||||
|
||||
def on_auto_away_checkbutton_toggled(self, widget):
|
||||
|
@ -539,21 +535,12 @@ class Preferences_window:
|
|||
return
|
||||
|
||||
def fill_sound_treeview(self):
|
||||
sounds = ['contact_disconnected', 'message_sent', 'contact_connected', \
|
||||
'first_message_received', 'next_message_received']
|
||||
events = {}
|
||||
# config file MUST have sound_event AND sound_enevt_file
|
||||
#events = {name : [use_it, file], name2 : [., .], ...}
|
||||
for key in sounds:
|
||||
if not (gajim.config.exist('sound_' + key) and gajim.config.exist(\
|
||||
'sound_' + key + '_file')):
|
||||
continue
|
||||
events[key] = [gajim.config.get('sound_' + key), \
|
||||
gajim.config.get('sound_' + key + '_file')]
|
||||
sounds = gajim.config.get_per('soundevents')
|
||||
model = self.sound_tree.get_model()
|
||||
model.clear()
|
||||
for ev in events:
|
||||
iter = model.append((ev, events[ev][0], events[ev][1]))
|
||||
for sound in sounds:
|
||||
iter = model.append((sound, gajim.config.get_per('soundevents', sound,\
|
||||
'enabled'), gajim.config.get_per('soundevents', sound, 'path')))
|
||||
|
||||
def on_treeview_sounds_cursor_changed(self, widget, data=None):
|
||||
(model, iter) = self.sound_tree.get_selection().get_selected()
|
||||
|
@ -642,7 +629,7 @@ class Preferences_window:
|
|||
self.iconset_combobox.set_model(model)
|
||||
l = []
|
||||
for i in list_style:
|
||||
if i != 'CVS' and i[0] != '.':
|
||||
if i[0] != '.':
|
||||
l.append(i)
|
||||
if l.count == 0:
|
||||
l.append(' ')
|
||||
|
@ -1481,26 +1468,16 @@ class Add_remove_emoticons_window:
|
|||
self.window.hide()
|
||||
|
||||
def on_emoticons_treemodel_row_deleted(self, model, path):
|
||||
iter = model.get_iter_first()
|
||||
emots = []
|
||||
while iter:
|
||||
emots.append(model.get_value(iter, 0))
|
||||
emots.append(model.get_value(iter, 1))
|
||||
iter = model.iter_next(iter)
|
||||
gajim.config.set('emoticons', '\t'.join(emots))
|
||||
self.plugin.init_regexp()
|
||||
iter = model.get_iter(path)
|
||||
gajim.config.get_per('emoticons', model.get_value(iter, 0))
|
||||
self.plugin.save_config()
|
||||
|
||||
def on_emoticons_treemodel_row_changed(self, model, path, iter):
|
||||
if model[path][1] != None and len(model[path][1]) != 0:
|
||||
iter = model.get_iter_first()
|
||||
emots = []
|
||||
while iter:
|
||||
emots.append(model.get_value(iter, 0))
|
||||
emots.append(model.get_value(iter, 1))
|
||||
iter = model.iter_next(iter)
|
||||
gajim.config.set('emoticons', '\t'.join(emots))
|
||||
self.plugin.init_regexp()
|
||||
emots = gajim.config.get_per('emoticons')
|
||||
emot = model.get_value(iter, 0)
|
||||
if not emot in emots:
|
||||
gajim.config.add_per('emoticons', emot)
|
||||
gajim.config.set_per('emoticons', emot, 'path', model.get_value(iter, 1))
|
||||
self.plugin.save_config()
|
||||
|
||||
def image_is_ok(self, image):
|
||||
|
@ -1519,22 +1496,13 @@ class Add_remove_emoticons_window:
|
|||
return 0
|
||||
return 1
|
||||
|
||||
def load_emots(self):
|
||||
emots = {}
|
||||
split_line = gajim.config.get('emoticons').split('\t')
|
||||
for i in range(0, len(split_line)/2):
|
||||
if not self.image_is_ok(split_line[2*i+1]):
|
||||
continue
|
||||
emots[split_line[2*i]] = split_line[2*i+1]
|
||||
return emots
|
||||
|
||||
def fill_emot_treeview(self):
|
||||
model = self.emot_tree.get_model()
|
||||
model.clear()
|
||||
emots = self.load_emots()
|
||||
for i in emots:
|
||||
file = emots[i]
|
||||
iter = model.append((i, file, None))
|
||||
emots = gajim.config.get_per('emoticons')
|
||||
for emot in emots:
|
||||
file = gajim.config.get_per('emoticons', emot, 'path')
|
||||
iter = model.append((emot, file, None))
|
||||
if not os.path.exists(file):
|
||||
continue
|
||||
img = gtk.Image()
|
||||
|
|
|
@ -311,9 +311,9 @@ class interface:
|
|||
#It isn't an agent
|
||||
self.roster.chg_user_status(user1, array[1], array[2], account)
|
||||
#play sound
|
||||
if old_show < 2 and new_show > 1 and gajim.config.get( \
|
||||
'sound_contact_connected'):
|
||||
self.play_sound('sound_contact_connected')
|
||||
if old_show < 2 and new_show > 1 and gajim.config.get_per( \
|
||||
'soundevents', 'contact_connected', 'enabled'):
|
||||
self.play_sound('contact_connected')
|
||||
if not self.windows[account]['chats'].has_key(jid) and \
|
||||
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
||||
'autopopup'):
|
||||
|
@ -328,9 +328,9 @@ class interface:
|
|||
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
|
||||
account)
|
||||
self.roster.popup_windows.append(instance)
|
||||
elif old_show > 1 and new_show < 2 and gajim.config.get( \
|
||||
'sound_contact_disconnected'):
|
||||
self.play_sound('sound_contact_disconnected')
|
||||
elif old_show > 1 and new_show < 2 and gajim.config.get_per( \
|
||||
'soundevents', 'contact_disconnected', 'enabled'):
|
||||
self.play_sound('contact_disconnected')
|
||||
if not self.windows[account]['chats'].has_key(jid) and \
|
||||
not self.queues[account].has_key(jid) and not gajim.config.get( \
|
||||
'autopopup'):
|
||||
|
@ -361,10 +361,12 @@ class interface:
|
|||
instance = dialogs.Popup_window(self, 'New Message', jid, account)
|
||||
self.roster.popup_windows.append(instance)
|
||||
self.roster.on_message(jid, array[1], array[2], account)
|
||||
if gajim.config.get('sound_first_message_received') and first:
|
||||
self.play_sound('sound_first_message_received')
|
||||
if gajim.config.get('sound_next_message_received') and not first:
|
||||
self.play_sound('sound_next_message_received')
|
||||
if gajim.config.get_per('soundevents', 'first_message_received', \
|
||||
'enabled') and first:
|
||||
self.play_sound('first_message_received')
|
||||
if gajim.config.get_per('soundevents', 'next_message_received', \
|
||||
'enabled') and not first:
|
||||
self.play_sound('next_message_received')
|
||||
|
||||
def handle_event_msgerror(self, account, array):
|
||||
#('MSGERROR', account, (user, error_code, error_msg, msg, time))
|
||||
|
@ -376,8 +378,8 @@ class interface:
|
|||
|
||||
def handle_event_msgsent(self, account, array):
|
||||
#('MSG', account, (jid, msg, keyID))
|
||||
if gajim.config.get('sound_message_sent'):
|
||||
self.play_sound('sound_message_sent')
|
||||
if gajim.config.get_per('soundevents', 'message_sent', 'enabled'):
|
||||
self.play_sound('message_sent')
|
||||
|
||||
def handle_event_subscribe(self, account, array):
|
||||
#('SUBSCRIBE', account, (jid, text))
|
||||
|
@ -641,13 +643,13 @@ class interface:
|
|||
def init_regexp(self):
|
||||
#initialize emoticons dictionary
|
||||
self.emoticons = dict()
|
||||
split_line = gajim.config.get('emoticons').split('\t')
|
||||
for i in range(0, len(split_line)/2):
|
||||
emot_file = split_line[2*i+1]
|
||||
emots = gajim.config.get_per('emoticons')
|
||||
for emot in emots:
|
||||
emot_file = gajim.config.get_per('emoticons', emot, 'path')
|
||||
if not self.image_is_ok(emot_file):
|
||||
continue
|
||||
pix = gtk.gdk.pixbuf_new_from_file(emot_file)
|
||||
self.emoticons[split_line[2*i]] = pix
|
||||
self.emoticons[emot] = pix
|
||||
|
||||
# update regular expressions
|
||||
self.make_regexps()
|
||||
|
|
Loading…
Reference in New Issue