From 74fd69cb0cce218a7941cb8a049389d1e6a2e9f6 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Wed, 1 Jun 2005 20:03:37 +0000
Subject: [PATCH] we now add default emoticons / status messages only if there
 is no in the config file

---
 src/common/config.py |  6 ------
 src/gajim.py         | 10 ++++++++++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/common/config.py b/src/common/config.py
index c0dbcd8ed..28146992b 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -342,10 +342,4 @@ class Config:
 			self.add_per('soundevents', event)
 			self.set_per('soundevents', event, 'enable', default[0])
 			self.set_per('soundevents', event, 'path', default[1])
-		for emot in self.emoticons_default:
-			self.add_per('emoticons', emot)
-			self.set_per('emoticons', emot, 'path', self.emoticons_default[emot])
-		for msg in self.statusmsg_default:
-			self.add_per('statusmsg', msg)
-			self.set_per('statusmsg', msg, 'message', self.statusmsg_default[msg])
 		return
diff --git a/src/gajim.py b/src/gajim.py
index f093686a7..29c42e6c2 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -723,6 +723,16 @@ class Interface:
 		}
 		parser.read()
 		gajim.verbose = gajim.config.get('verbose')
+		#add default emoticons is there is not in the config file
+		if len(gajim.config.get_per('emoticons')) == 0:
+			for emot in gajim.config.emoticons_default:
+				gajim.config.add_per('emoticons', emot)
+				gajim.config.set_per('emoticons', emot, 'path', gajim.config.emoticons_default[emot])
+		#add default status messages is there is not in the config file
+		if len(gajim.config.get_per('statusmsg')) == 0:
+			for msg in gajim.config.statusmsg_default:
+				gajim.config.add_per('statusmsg', msg)
+				gajim.config.set_per('statusmsg', msg, 'message', gajim.config.statusmsg_default[msg])
 
 		if gajim.verbose:
 			gajim.log.setLevel(gajim.logging.DEBUG)