From 3bac6caec3e59f72736bde583d027f9fbb8f0737 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Mon, 14 Mar 2005 21:46:55 +0000
Subject: [PATCH] regreat the regex when we add a new emoticon

---
 plugins/gtkgui/config.py |  4 ++--
 plugins/gtkgui/gtkgui.py | 27 +++++++++++++++------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py
index 9576f27d34..0f173ecc9f 100644
--- a/plugins/gtkgui/config.py
+++ b/plugins/gtkgui/config.py
@@ -288,7 +288,7 @@ class preferences_window:
 			emots.append(model.get_value(iter, 1))
 			iter = model.iter_next(iter)
 		self.plugin.config['emoticons'] = '\t'.join(emots)
-		self.plugin.roster.mkemoticons()
+		self.plugin.init_regex()
 
 	def on_emoticons_treemodel_row_changed(self, model, path, iter):
 		if model[path][1] != None and len(model[path][1]) != 0:
@@ -299,7 +299,7 @@ class preferences_window:
 				emots.append(model.get_value(iter, 1))
 				iter = model.iter_next(iter)
 			self.plugin.config['emoticons'] = '\t'.join(emots)
-			self.plugin.roster.mkemoticons()
+			self.plugin.init_regex()
 
 	def on_auto_pop_up_checkbox_toggled(self, widget):
 		self.on_checkbutton_toggled(widget, 'autopopup', None,\
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 091c0d195e..309aa32121 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -736,6 +736,20 @@ class plugin:
 	def on_launch_browser_mailer(self, widget, url, kind):
 		self.launch_browser_mailer(kind, url)
 
+	def init_regex(self):
+		if self.config['useemoticons']:
+			"""initialize emoticons dictionary"""
+			self.emoticons = dict()
+			split_line = self.config['emoticons'].split('\t')
+			for i in range(0, len(split_line)/2):
+				emot_file = split_line[2*i+1]
+				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.make_regexps()
+
 	def __init__(self, quIN, quOUT):
 		gtk.gdk.threads_init()
 		if not gtk.check_version(2, 6, 0):
@@ -860,18 +874,7 @@ class plugin:
 		if self.config['trayicon']:
 			self.show_systray()
 			
-		if self.config['useemoticons']:
-			"""initialize emoticons dictionary"""
-			self.emoticons = dict()
-			split_line = self.config['emoticons'].split('\t')
-			for i in range(0, len(split_line)/2):
-				emot_file = split_line[2*i+1]
-				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.make_regexps()
+		self.init_regex()
 
 		gtk.gdk.threads_enter()
 		self.autoconnect()
-- 
GitLab