Hello community,

here is the log from the commit of package hexchat for openSUSE:Factory checked 
in at 2016-05-08 10:45:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hexchat (Old)
 and      /work/SRC/openSUSE:Factory/.hexchat.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hexchat"

Changes:
--------
--- /work/SRC/openSUSE:Factory/hexchat/hexchat.changes  2016-04-28 
16:57:47.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.hexchat.new/hexchat.changes     2016-05-08 
10:46:22.000000000 +0200
@@ -1,0 +2,8 @@
+Thu May  5 08:58:05 UTC 2016 - [email protected]
+
+- Add migrate-configuration-from-xchat.patch
+  Fate#318480:replace xchat with hexchat,automaticly migrate
+  settings from xchat:
+  
http://hexchat.readthedocs.io/en/latest/faq.html#how-do-i-migrate-my-settings-from-xchat
+
+-------------------------------------------------------------------

New:
----
  migrate-configuration-from-xchat.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hexchat.spec ++++++
--- /var/tmp/diff_new_pack.gKZ6dR/_old  2016-05-08 10:46:22.000000000 +0200
+++ /var/tmp/diff_new_pack.gKZ6dR/_new  2016-05-08 10:46:22.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package hexchat
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
 # Copyright (c) 2013 Andrey Karepin <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
@@ -27,6 +27,8 @@
 Source0:        https://dl.%{name}.net/%{name}/%{name}-%{version}.tar.xz
 # PATCH-FIX-UPSTREAM: Fix build with python3
 Patch0:         hexchat-python3.patch
+# PATCH-FEATURE-SLE migrate-configuration-from-xchat.patch [email protected] 
fate#318480 -- replace xchat with hexchat
+Patch1:         migrate-configuration-from-xchat.patch
 BuildRequires:  bison >= 1.35
 BuildRequires:  dbus-1-devel
 BuildRequires:  dbus-1-glib-devel
@@ -96,6 +98,7 @@
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 # fix date embedding to avoid needless rebuilds
 FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e 
%%Y')

++++++ migrate-configuration-from-xchat.patch ++++++
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 4bf2f47..35c330f 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -938,6 +938,84 @@ make_config_dirs (void)
        return 0;
 }
 
+void
+migrate_conf_from_xchat (void)
+{
+    char *xchat_conf;
+    char *logs_xchat;
+    char *xchat_dir = g_build_filename (g_get_home_dir (), ".xchat2", NULL);
+    if (!g_file_test (xchat_dir, G_FILE_TEST_EXISTS))
+    {
+        g_printf ("%s not exists",xchat_dir);
+        g_free (xchat_dir);
+        return;
+    }
+
+    xchat_conf = g_build_filename (xchat_dir, "xchat.conf", NULL);
+    if (g_file_test (xchat_conf, G_FILE_TEST_EXISTS))
+    {
+        char *hexchat_conf = g_build_filename (get_xdir (), "hexchat.conf", 
NULL);
+        g_rename (xchat_conf, hexchat_conf);
+        g_free (hexchat_conf);
+    }
+    g_free (xchat_conf);
+
+    logs_xchat = g_build_filename (xchat_dir, "xchatlogs", NULL);
+    if (g_file_test (logs_xchat, G_FILE_TEST_EXISTS))
+    {
+        char *logs_hexchat = g_build_filename (get_xdir (), "logs", NULL);
+        g_rename (logs_xchat, logs_hexchat);
+        g_free (logs_hexchat);
+    }
+    g_free (logs_xchat);
+
+    g_free (xchat_dir);
+}
+
+static void move_file_from_xchat_xdir (char *des_dir, char *src)
+{
+    GFile *file = g_file_new_for_path (src);
+    char *filename = g_file_get_basename (file);
+    g_print ("move %s to %s\n",src,des_dir);
+    if (g_file_test (des_dir, G_FILE_TEST_EXISTS))
+    {
+        char *des = g_build_filename (des_dir, filename, NULL);
+        g_print ("from %s to %s\n",src,des);
+        g_rename (src,des);
+        g_free (des);
+    }
+
+    g_free (filename);
+    g_object_unref (file);
+}
+
+static void move_to_dir_addons (char *filename)
+{
+    char *des_dir = g_build_filename (get_xdir (), "addons", NULL);
+    move_file_from_xchat_xdir (des_dir, filename);
+    g_free (des_dir);
+}
+
+static void move_to_dir_certs (char* filename)
+{
+    char *des_dir = g_build_filename (get_xdir (), "certs", NULL);
+    move_file_from_xchat_xdir (des_dir, filename);
+    g_free (des_dir);
+}
+
+void
+migrate_addons_and_certs_from_xchat (void)
+{
+    char *xchat_dir = g_build_filename (g_get_home_dir (), ".xchat2", NULL);
+    if (g_file_test (xchat_dir, G_FILE_TEST_EXISTS))
+    {
+       g_print ("~/.xchat/ exixts\n");
+       for_files (xchat_dir, "*.so", move_to_dir_addons);
+       for_files (xchat_dir, "*.pem", move_to_dir_certs);
+    }
+    g_free (xchat_dir);
+}
+
 int
 make_dcc_dirs (void)
 {
diff --git a/src/common/cfgfiles.h b/src/common/cfgfiles.h
index b421884..a2e7620 100644
--- a/src/common/cfgfiles.h
+++ b/src/common/cfgfiles.h
@@ -39,6 +39,8 @@ int cfg_put_color (int fh, guint16 r, guint16 g, guint16 b, 
char *var);
 char *get_xdir (void);
 int check_config_dir (void);
 void load_default_config (void);
+void migrate_conf_from_xchat (void);
+void migrate_addons_and_certs_from_xchat (void);
 int make_config_dirs (void);
 int make_dcc_dirs (void);
 int load_config (void);
diff --git a/src/common/hexchat.c b/src/common/hexchat.c
index caa20eb..e07d7a8 100644
--- a/src/common/hexchat.c
+++ b/src/common/hexchat.c
@@ -1041,8 +1041,11 @@ main (int argc, char *argv[])
        } else
        {
                /* this is probably the first run */
-               load_default_config ();
                make_config_dirs ();
+                migrate_conf_from_xchat ();
+               if (load_config () != 0)
+                   load_default_config ();
+                migrate_addons_and_certs_from_xchat ();
                make_dcc_dirs ();
        }
 

Reply via email to