Hello community,

here is the log from the commit of package Srain for openSUSE:Factory checked 
in at 2020-10-05 19:40:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/Srain (Old)
 and      /work/SRC/openSUSE:Factory/.Srain.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "Srain"

Mon Oct  5 19:40:59 2020 rev:6 rq:839392 version:1.1.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/Srain/Srain.changes      2020-06-27 
23:23:09.821937367 +0200
+++ /work/SRC/openSUSE:Factory/.Srain.new.4249/Srain.changes    2020-10-05 
19:42:56.413775518 +0200
@@ -1,0 +2,8 @@
+Sun Oct  4 08:29:52 UTC 2020 - Luigi Baldoni <[email protected]>
+
+- Update to version 1.1.3
+  * fix an use-after-free case
+  * remove server when main loop is idle
+- Add Srain-no_implicit_declarations.patch
+
+-------------------------------------------------------------------

Old:
----
  Srain-1.1.1.tar.gz

New:
----
  Srain-1.1.3.tar.gz
  Srain-no_implicit_declarations.patch

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

Other differences:
------------------
++++++ Srain.spec ++++++
--- /var/tmp/diff_new_pack.SAwfFO/_old  2020-10-05 19:42:57.057776147 +0200
+++ /var/tmp/diff_new_pack.SAwfFO/_new  2020-10-05 19:42:57.057776147 +0200
@@ -17,12 +17,14 @@
 
 
 Name:           Srain
-Version:        1.1.1
+Version:        1.1.3
 Release:        0
 Summary:        An IRC client
 License:        GPL-3.0-or-later AND ISC
 URL:            https://srain.im
 Source:         
https://github.com/SrainApp/srain/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM Srain-no_implicit_declarations.patch
+Patch0:         Srain-no_implicit_declarations.patch
 BuildRequires:  ImageMagick
 BuildRequires:  hicolor-icon-theme
 BuildRequires:  pkgconfig
@@ -42,7 +44,7 @@
 %lang_package
 
 %prep
-%autosetup -n srain-%{version}
+%autosetup -p1 -n srain-%{version}
 
 %build
 %configure --disable-debug

++++++ Srain-1.1.1.tar.gz -> Srain-1.1.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/.github/workflows/build.yml 
new/srain-1.1.3/.github/workflows/build.yml
--- old/srain-1.1.1/.github/workflows/build.yml 2020-06-27 06:31:18.000000000 
+0200
+++ new/srain-1.1.3/.github/workflows/build.yml 2020-10-04 03:11:49.000000000 
+0200
@@ -13,7 +13,7 @@
   schedule:
     - cron: '0 7 * * 6'
 jobs:
-  build:
+  build-ubuntu:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v2
@@ -33,3 +33,27 @@
       run: |
         sudo make install;
         /bin/sh -c "/usr/local/bin/srain --version";
+
+  build-mingw64:
+    runs-on: windows-latest
+    defaults:
+      run:
+        shell: msys2 {0}
+    steps:
+    - uses: actions/checkout@v2
+    - uses: msys2/setup-msys2@v1
+      name: Init MSYS2/MINGW64 environment
+      with:
+        update: true
+        msystem: MINGW64
+        install: base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-gtk3 
mingw-w64-x86_64-libconfig mingw-w64-x86_64-libsoup mingw-w64-x86_64-libsecret 
mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gettext 
mingw-w64-x86_64-glib-networking
+    - name: Build
+      run: |
+        ./configure \
+        --prefix=$MINGW_PREFIX \
+        --datadir=$MINGW_PREFIX/share \
+        --sysconfdir=$MINGW_PREFIX/etc \
+        --disable-debug && \
+        make && \
+        make install && \
+        srain --version;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/.github/workflows/pack-mingw64.sh 
new/srain-1.1.3/.github/workflows/pack-mingw64.sh
--- old/srain-1.1.1/.github/workflows/pack-mingw64.sh   1970-01-01 
01:00:00.000000000 +0100
+++ new/srain-1.1.3/.github/workflows/pack-mingw64.sh   2020-10-04 
03:11:49.000000000 +0200
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+if [ $# -ne 3 ]; then
+    echo "Usage:"
+    echo "    ./package_mingw64.sh srain_install_dir tmp_dir_to_package 
output_package.zip"
+    exit 1
+fi
+
+function get_dll() {
+    ret=""
+    for var in "$@"
+    do
+        echo "DLLs used by $var:"
+        echo `ldd $var`
+        ret+="$(ldd $var | tr '=>'  '\n'| grep -o '/mingw64.*\.dll' | sort -u) 
"
+    done
+}
+
+prefix=$MINGW_PREFIX
+
+install_dir=$1
+srain_exe=$install_dir/bin/srain
+srain_etc=$install_dir/etc/srain
+srain_share=$install_dir/share/*
+
+tmp_dir=$2
+dst_bin=$tmp_dir
+dst_etc=$tmp_dir/etc
+dst_lib=$tmp_dir/lib
+dst_share=$tmp_dir/share
+
+output_file=$3
+
+# gdbus
+gdbus=$prefix/bin/gdbus.exe
+
+# srain
+cp -vf $srain_exe $prefix/bin/srain # make DLLs of mingw64 have the highest 
priority
+get_dll $prefix/bin/srain
+mingw64_dlls=$ret
+
+# glib-networking
+libgio_modules=$(ls $prefix/lib/gio/modules/lib*.dll)
+get_dll $libgio_modules
+mingw64_dlls+=$ret
+
+# gdbus
+get_dll $gdbus
+mingw64_dlls+=$ret
+
+mingw64_dlls=$(echo $mingw64_dlls | tr ' ' '\n' | sort -u)
+
+mkdir -pv $dst_bin
+mkdir -pv $dst_lib
+mkdir -pv $dst_etc
+mkdir -pv $dst_share
+
+# portable installation of srain
+cp -rfv $srain_exe $dst_bin/srain.exe
+cp -rfv $srain_etc $dst_etc/
+cp -rfv $srain_share $dst_share/
+mkdir -pv $dst_bin/logs
+touch $dst_bin/srain.cfg
+
+echo 'Finished installing Srain'
+
+cp -rfv $gdbus $dst_bin/
+cp -rfv $mingw64_dlls $dst_bin/
+cp -rfv $prefix/lib/gio $dst_lib/
+cp -rfv $prefix/lib/gdk-pixbuf-2.0 $dst_lib/
+cp -rfv $prefix/share/icons $dst_share/
+cp -rfv $prefix/share/glib-2.0 $dst_share/
+
+echo 'Finished installing DLLs required by Srain'
+
+# Remove icon-theme.cache to fix incorrect icon showed in the taskbar
+rm -f $dst_share/icons/*/icon-theme.cache
+
+zip -r $output_file $tmp_dir
+
+echo 'Done'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/.github/workflows/release.yml 
new/srain-1.1.3/.github/workflows/release.yml
--- old/srain-1.1.1/.github/workflows/release.yml       2020-06-27 
06:31:18.000000000 +0200
+++ new/srain-1.1.3/.github/workflows/release.yml       2020-10-04 
03:11:49.000000000 +0200
@@ -18,3 +18,40 @@
       run: .github/workflows/release-debian-package.sh
     - name: upload the assets
       run: .github/workflows/release-assets-upload.py
+  mingw64:
+    runs-on: windows-latest
+    defaults:
+      run:
+        shell: msys2 {0}
+    env:
+      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      GH_REPO: ${{ github.repository }}
+      GH_REF: ${{ github.ref }}
+    steps:
+    - uses: actions/checkout@v2
+    - uses: msys2/setup-msys2@v1
+      name: Init MSYS2/MINGW64 environment
+      with:
+        update: true
+        msystem: MINGW64
+        install: base-devel git curl zip mingw-w64-x86_64-python-requests 
mingw-w64-x86_64-gcc mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libconfig 
mingw-w64-x86_64-libsoup mingw-w64-x86_64-libsecret mingw-w64-x86_64-pkg-config 
mingw-w64-x86_64-gettext mingw-w64-x86_64-glib-networking
+    - name: Build
+      run: |
+        SRAIN_TAG=`git describe --tags`;
+        INSTALL_DIR=srain-$SRAIN_TAG-mingw64-install;
+        PACKAGE_DIR=srain-$SRAIN_TAG-mingw64;
+        PACKAGE_NAME=$PACKAGE_DIR.zip;
+        mkdir -pv out;
+        mkdir -pv $INSTALL_DIR;
+        ./configure \
+          --prefix=$MINGW_PREFIX \
+          --datadir=$MINGW_PREFIX/share \
+          --sysconfdir=$MINGW_PREFIX/etc \
+          --disable-debug && \
+        make && \
+        make DESTDIR=$PWD/$INSTALL_DIR install && \
+        .github/workflows/pack-mingw64.sh $INSTALL_DIR/$MINGW_PREFIX 
$PACKAGE_DIR $PACKAGE_NAME && \
+        mv $PACKAGE_NAME ./out
+    - name: Upload
+      run: /mingw64/bin/python3 .github/workflows/release-assets-upload.py
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/Makefile.in new/srain-1.1.3/Makefile.in
--- old/srain-1.1.1/Makefile.in 2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/Makefile.in 2020-10-04 03:11:49.000000000 +0200
@@ -10,7 +10,7 @@
 PACKAGE_BUILD = $(shell [ -d .git ] && \
                                git rev-parse --git-dir > /dev/null 2>&1 && \
                                echo -n -git@0.`git rev-list --count HEAD`.`git 
describe --always`)
-PACKAGE_VERSION = 1.1.1
+PACKAGE_VERSION = 1.1.3
 PACKAGE_AUTHOR = Shengyu Zhang
 PACKAGE_EMAIL = [email protected]
 PACKAGE_DESC = Modern IRC client written in GTK
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/doc/changelog.rst 
new/srain-1.1.3/doc/changelog.rst
--- old/srain-1.1.1/doc/changelog.rst   2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/doc/changelog.rst   2020-10-04 03:11:49.000000000 +0200
@@ -30,6 +30,28 @@
 
 .. _version-latest:
 
+.. _version-1.1.2:
+
+2020-08-10 Version 1.1.2
+========================
+
+.. note::
+
+    This release contains only improvement for MS Windows,
+    user of other platform can ignore it.
+
+- Features:
+
+  - Binary for MS Windows now can automatically built via Github Actions,
+    thanks to :people:`lifeibiren` (:pull:`259`), please refer to
+    :ref:`install-packages-windows` for more details
+
+- Changes:
+
+  - For ease of running on windows, Srain's executable path is added to the
+    search paths of {configuration,data} file. Thanks to :people:`lifeibiren`
+    (:pull:`259`)
+
 .. _version-1.1.1:
 
 2020-06-27 Version 1.1.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/doc/conf.py new/srain-1.1.3/doc/conf.py
--- old/srain-1.1.1/doc/conf.py 2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/doc/conf.py 2020-10-04 03:11:49.000000000 +0200
@@ -55,9 +55,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = '1.1.1'
+version = '1.1.3'
 # The full version, including alpha/beta/rc tags.
-release = '1.1.1'
+release = '1.1.3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/doc/install.rst 
new/srain-1.1.3/doc/install.rst
--- old/srain-1.1.1/doc/install.rst     2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/doc/install.rst     2020-10-04 03:11:49.000000000 +0200
@@ -8,7 +8,6 @@
 
 .. contents::
     :local:
-    :depth: 3
     :backlinks: none
 
 .. _install-dependencies:
@@ -44,11 +43,11 @@
 Firstly, download source code of srain,
 you can get source code of latest release:
 
-.. code-block:: console
+.. parsed-literal::
 
-    $ wget https://github.com/SrainApp/srain/archive/1.1.1.tar.gz
-    $ tar -xvzf 1.1.1.tar.gz
-    $ cd srain-1.1.1
+    $ wget https://github.com/SrainApp/srain/archive/|release|.tar.gz
+    $ tar -xvzf |release|.tar.gz
+    $ cd srain-|release|
 
 Or get git version:
 
@@ -120,8 +119,15 @@
 Debian
 ~~~~~~
 
-There is no srain package in the official repository yet. But you can package
-it by yourself.
+There is no srain package in the official repository yet.
+
+Pre-built package
+.................
+
+We provide pre-built deb package that you can get it from `Github release 
page`_.
+
+Build byself
+............
 
 Copy the debian folder on `srain-contrib`_ to srain folder. Then type following
 command on your terminal:
@@ -135,9 +141,9 @@
 
 Then install the package (replace package name with the name of your package):
 
-.. code-block:: console
+.. parsed-literal::
 
-    $ sudo apt-get install -f ../srain_1.0.1-1_amd64.deb 
+    $ sudo apt-get install -f ../srain\_\ |release|-1_amd64.deb
 
 .. _srain-contrib: https://github.com/SrainApp/srain-contrib/tree/master/pack/
 .. _debian/crontrol: 
https://github.com/SrainApp/srain-contrib/blob/master/pack/debian/control
@@ -200,12 +206,21 @@
 Windows
 -------
 
-.. warning:: Windows support of Srain is still experimental.
-
 Srain requires Windows 7 or later.
 
-The easiest way to build/run Srain on Windows is using the toolchains provided
-by `MSYS2 project`_.
+Pre-built package
+~~~~~~~~~~~~~~~~~
+
+After :ref:`version-1.1.2`, we provide Windows portable binary that you can
+get it from `Github release page`_.
+
+.. _Github release page: https://github.com/SrainApp/srain/releases
+
+Build byself
+~~~~~~~~~~~~
+
+If you want to build Srain on Windows youself,
+you should use the toolchains provided by `MSYS2 project`_.
 
 Firstly install MSYS2, then open a MSYS2 shell, install the basic build tools:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/po/nl.po new/srain-1.1.3/po/nl.po
--- old/srain-1.1.1/po/nl.po    2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/po/nl.po    2020-10-04 03:11:49.000000000 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: Srain 1.0.0\n"
 "Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2020-06-27 12:05+0800\n"
+"POT-Creation-Date: 2020-08-02 16:09+0800\n"
 "PO-Revision-Date: 2020-03-07 20:14+0100\n"
 "Last-Translator: \n"
 "Language-Team: \n"
@@ -424,27 +424,27 @@
 msgid "Failed to connect to %1$s(%2$s:%3$d): %4$s"
 msgstr "Kan niet verbinden met %1$s(%2$s:%3$d): %4$s"
 
-#: ../src/lib/path.c:184
+#: ../src/lib/path.c:301
 #, c-format
 msgid "Failed to create chat logs directory: %1$s"
 msgstr "Kan de chatlogmap niet aanmaken: %1$s"
 
-#: ../src/lib/path.c:164
+#: ../src/lib/path.c:281
 #, c-format
 msgid "Failed to create user cache directory: %1$s"
 msgstr "Kan de gebruikerscachemap niet aanmaken: %1$s"
 
-#: ../src/lib/path.c:144
+#: ../src/lib/path.c:261
 #, c-format
 msgid "Failed to create user configuration directory: %1$s"
 msgstr "Kan de gebruikersconfiguratiemap niet aanmaken: %1$s"
 
-#: ../src/lib/path.c:154
+#: ../src/lib/path.c:271
 #, c-format
 msgid "Failed to create user configuration file: %1$s"
 msgstr "Kan het gebruikersconfiguratiebestand niet aanmaken: %1$s"
 
-#: ../src/lib/path.c:174
+#: ../src/lib/path.c:291
 #, c-format
 msgid "Failed to create user data directory: %1$s"
 msgstr "Kan de gebruikersgegevensmap niet aanmaken: %1$s"
@@ -734,11 +734,11 @@
 msgid "No topic is set"
 msgstr "Geen onderwerp ingesteld"
 
-#: ../src/lib/path.c:199
+#: ../src/lib/path.c:316
 msgid "Not a directory"
 msgstr "Geen map"
 
-#: ../src/lib/path.c:218
+#: ../src/lib/path.c:335
 msgid "Not a regular file"
 msgstr "Geen regulier bestand"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/po/ru.po new/srain-1.1.3/po/ru.po
--- old/srain-1.1.1/po/ru.po    2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/po/ru.po    2020-10-04 03:11:49.000000000 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: Srain 1.0.0\n"
 "Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2020-06-27 12:05+0800\n"
+"POT-Creation-Date: 2020-08-02 16:09+0800\n"
 "PO-Revision-Date: 2019-04-17 16:14+0300\n"
 "Last-Translator: Artem Polishchuk <[email protected]>\n"
 "Language-Team: \n"
@@ -430,27 +430,27 @@
 msgid "Failed to connect to %1$s(%2$s:%3$d): %4$s"
 msgstr "Не удалось подключиться к %1$s(%2$s:%3$d): %4$s"
 
-#: ../src/lib/path.c:184
+#: ../src/lib/path.c:301
 #, fuzzy, c-format
 msgid "Failed to create chat logs directory: %1$s"
 msgstr "Не удалось создать каталог журналов чата: %s"
 
-#: ../src/lib/path.c:164
+#: ../src/lib/path.c:281
 #, fuzzy, c-format
 msgid "Failed to create user cache directory: %1$s"
 msgstr "Не удалось создать каталог кэша пользователя: %s"
 
-#: ../src/lib/path.c:144
+#: ../src/lib/path.c:261
 #, fuzzy, c-format
 msgid "Failed to create user configuration directory: %1$s"
 msgstr "Не удалось создать каталог конфигурации пользователя: %s"
 
-#: ../src/lib/path.c:154
+#: ../src/lib/path.c:271
 #, fuzzy, c-format
 msgid "Failed to create user configuration file: %1$s"
 msgstr "Не удалось создать файл конфигурации пользователя: %s"
 
-#: ../src/lib/path.c:174
+#: ../src/lib/path.c:291
 #, fuzzy, c-format
 msgid "Failed to create user data directory: %1$s"
 msgstr "Не удалось создать каталог пользовательских данных: %s"
@@ -742,11 +742,11 @@
 msgid "No topic is set"
 msgstr "Тема не установлена"
 
-#: ../src/lib/path.c:199
+#: ../src/lib/path.c:316
 msgid "Not a directory"
 msgstr "Не каталог"
 
-#: ../src/lib/path.c:218
+#: ../src/lib/path.c:335
 msgid "Not a regular file"
 msgstr "Не обычный файл"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/po/srain.pot new/srain-1.1.3/po/srain.pot
--- old/srain-1.1.1/po/srain.pot        2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/po/srain.pot        2020-10-04 03:11:49.000000000 +0200
@@ -6,9 +6,9 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: Srain 1.0.1\n"
+"Project-Id-Version: Srain 1.1.1\n"
 "Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2020-06-27 12:05+0800\n"
+"POT-Creation-Date: 2020-08-02 16:09+0800\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <[email protected]>\n"
@@ -418,27 +418,27 @@
 msgid "Failed to connect to %1$s(%2$s:%3$d): %4$s"
 msgstr ""
 
-#: ../src/lib/path.c:184
+#: ../src/lib/path.c:301
 #, c-format
 msgid "Failed to create chat logs directory: %1$s"
 msgstr ""
 
-#: ../src/lib/path.c:164
+#: ../src/lib/path.c:281
 #, c-format
 msgid "Failed to create user cache directory: %1$s"
 msgstr ""
 
-#: ../src/lib/path.c:144
+#: ../src/lib/path.c:261
 #, c-format
 msgid "Failed to create user configuration directory: %1$s"
 msgstr ""
 
-#: ../src/lib/path.c:154
+#: ../src/lib/path.c:271
 #, c-format
 msgid "Failed to create user configuration file: %1$s"
 msgstr ""
 
-#: ../src/lib/path.c:174
+#: ../src/lib/path.c:291
 #, c-format
 msgid "Failed to create user data directory: %1$s"
 msgstr ""
@@ -723,11 +723,11 @@
 msgid "No topic is set"
 msgstr ""
 
-#: ../src/lib/path.c:199
+#: ../src/lib/path.c:316
 msgid "Not a directory"
 msgstr ""
 
-#: ../src/lib/path.c:218
+#: ../src/lib/path.c:335
 msgid "Not a regular file"
 msgstr ""
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/po/zh_CN.po new/srain-1.1.3/po/zh_CN.po
--- old/srain-1.1.1/po/zh_CN.po 2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/po/zh_CN.po 2020-10-04 03:11:49.000000000 +0200
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: Srain 1.0.0\n"
 "Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2020-06-27 12:05+0800\n"
+"POT-Creation-Date: 2020-08-02 16:09+0800\n"
 "PO-Revision-Date: 2016-12-18 01:44+0800\n"
 "Last-Translator: Automatically generated\n"
 "Language-Team: none\n"
@@ -423,27 +423,27 @@
 msgid "Failed to connect to %1$s(%2$s:%3$d): %4$s"
 msgstr "无法连接到 %1$s(%2$s:%3$d):%4$s"
 
-#: ../src/lib/path.c:184
+#: ../src/lib/path.c:301
 #, c-format
 msgid "Failed to create chat logs directory: %1$s"
 msgstr "无法创建聊天日志文件夹 \"%1$s\""
 
-#: ../src/lib/path.c:164
+#: ../src/lib/path.c:281
 #, c-format
 msgid "Failed to create user cache directory: %1$s"
 msgstr "无法创建用户缓存文件夹 \"%1$s\""
 
-#: ../src/lib/path.c:144
+#: ../src/lib/path.c:261
 #, c-format
 msgid "Failed to create user configuration directory: %1$s"
 msgstr "无法创建用户配置文件夹 \"%1$s\""
 
-#: ../src/lib/path.c:154
+#: ../src/lib/path.c:271
 #, c-format
 msgid "Failed to create user configuration file: %1$s"
 msgstr "无法创建用户配置文件 \"%1$s\""
 
-#: ../src/lib/path.c:174
+#: ../src/lib/path.c:291
 #, c-format
 msgid "Failed to create user data directory: %1$s"
 msgstr "无法创建用户数据文件夹 \"%1$s\""
@@ -730,11 +730,11 @@
 msgid "No topic is set"
 msgstr "该频道没有设置主题"
 
-#: ../src/lib/path.c:199
+#: ../src/lib/path.c:316
 msgid "Not a directory"
 msgstr "不是一个文件夹"
 
-#: ../src/lib/path.c:218
+#: ../src/lib/path.c:335
 msgid "Not a regular file"
 msgstr "不是一个常规文件"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/src/Makefile new/srain-1.1.3/src/Makefile
--- old/srain-1.1.1/src/Makefile        2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/src/Makefile        2020-10-04 03:11:49.000000000 +0200
@@ -45,6 +45,10 @@
                   $(LIBSSLLIBS) \
                   $(LIBSECRETLIBS)
 
+ifeq ($(OS),Windows_NT)
+LDFLAGS += -mwindows
+endif
+
 SRCS = $(wildcard *.c */*.c */*/*.c $(BUILD_DIR)/resources.c)
 OBJS = $(patsubst %.c, $(BUILD_DIR)/%.o, $(notdir $(SRCS)))
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/src/core/server_state.c 
new/srain-1.1.3/src/core/server_state.c
--- old/srain-1.1.1/src/core/server_state.c     2020-06-27 06:31:18.000000000 
+0200
+++ new/srain-1.1.3/src/core/server_state.c     2020-10-04 03:11:49.000000000 
+0200
@@ -38,6 +38,7 @@
 static const char *srn_server_state_to_string(SrnServerState state);
 static const char *srn_server_action_to_string(SrnServerAction action);
 static gboolean srn_server_reconnect_timeout(gpointer user_data);
+static gboolean idle_to_rm_server(gpointer user_data);
 
 /**
  * @brief server_state_transfrom SrnServer's connection state macheine, accept 
a
@@ -236,11 +237,13 @@
                 RET_MSG(ret));
     }
 
-    if (free){ // The server should be free now, be careful
-        SrnApplication *app;
 
-        app = srn_application_get_default();
-        return srn_application_rm_server(app, srv);
+    if (free){ // The server should be free now, be careful
+        // Remove the given server when main loop idle,
+        // because server may be referenceed after returning
+        //
+        // https://github.com/SrainApp/srain/issues/258
+        g_idle_add(idle_to_rm_server, srv);
     }
 
     return ret;
@@ -297,3 +300,14 @@
 
     return G_SOURCE_REMOVE;
 }
+
+static gboolean idle_to_rm_server(gpointer user_data){
+    SrnServer *srv;
+
+    srv = user_data;
+    g_return_val_if_fail(srn_server_is_valid(srv), G_SOURCE_REMOVE);
+
+    srn_application_rm_server(srn_application_get_default(), srv);
+
+    return G_SOURCE_REMOVE;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/src/inc/path.h 
new/srain-1.1.3/src/inc/path.h
--- old/srain-1.1.1/src/inc/path.h      2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/src/inc/path.h      2020-10-04 03:11:49.000000000 +0200
@@ -1,4 +1,5 @@
 /* Copyright (C) 2016-2017 Shengyu Zhang <[email protected]>
+ * Copyright (C) 2020 Fei Li <[email protected]>
  *
  * This file is part of Srain.
  *
@@ -26,5 +27,7 @@
 char *srn_get_system_config_file();
 char *srn_create_log_file(const char *srv_name, const char *fname);
 SrnRet srn_create_user_file();
+char *srn_get_executable_path();
+char *srn_get_executable_dir();
 
 #endif /* __FILE_HELPER_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/src/lib/path.c 
new/srain-1.1.3/src/lib/path.c
--- old/srain-1.1.1/src/lib/path.c      2020-06-27 06:31:18.000000000 +0200
+++ new/srain-1.1.3/src/lib/path.c      2020-10-04 03:11:49.000000000 +0200
@@ -1,4 +1,5 @@
 /* Copyright (C) 2016-2018 Shengyu Zhang <[email protected]>
+ * Copyright (C) 2020 Fei Li <[email protected]>
  *
  * This file is part of Srain.
  *
@@ -34,6 +35,30 @@
 #include "meta.h"
 #include "log.h"
 #include "i18n.h"
+#include "path.h"
+
+#ifdef _WIN32
+#include <windows.h>
+#include <Shlwapi.h>
+#include <io.h>
+
+#elif defined __APPLE__
+#include <libgen.h>
+#include <limits.h>
+#include <mach-o/dyld.h>
+#include <unistd.h>
+
+#elif defined __linux__
+#include <limits.h>
+#include <libgen.h>
+#include <unistd.h>
+
+#ifdef __sun
+#define PROC_SELF_EXE "/proc/self/path/a.out"
+#else
+#define PROC_SELF_EXE "/proc/self/exe"
+#endif
+#endif
 
 #define DEFAULT_FILE_MODE   (S_IRUSR | S_IWUSR)
 #define DEFAULT_DIR_MODE    (S_IRWXU)
@@ -41,6 +66,81 @@
 static SrnRet create_file_if_not_exist(const char *path);
 static SrnRet create_dir_if_not_exist(const char *path);
 
+static void strfreev(char **prefix){
+    if (*prefix) {
+        g_free(*prefix);
+        strfreev(prefix + 1);
+    }
+}
+
+static char *srn_find_file_in_prefix(char *prefix[], const char *name){
+    char *path;
+
+    for (;;){
+        if (*prefix == NULL){
+            break;
+        }
+
+        path = g_build_filename(*prefix, name, NULL);
+
+        if (g_file_test(path, G_FILE_TEST_EXISTS)){
+            return path;
+        }
+
+        g_free(path);
+
+        ++prefix;
+    }
+
+    return NULL;
+}
+
+static char *srn_try_to_find_data_file(const char *name){
+    char *path;
+    char *prefix[] = {
+        g_build_filename(PACKAGE_DATA_DIR, PACKAGE, NULL),
+        g_build_filename(srn_get_executable_dir(), "share", PACKAGE, NULL),
+        g_build_filename(srn_get_executable_dir(), "..", "share", PACKAGE, 
NULL),
+        srn_get_executable_dir(),
+        NULL
+    };
+
+    path = srn_find_file_in_prefix(prefix, name);
+
+    strfreev(prefix);
+    return path;
+}
+
+static char *srn_try_to_find_config_file(const char *name){
+    char *path;
+    char *prefix[] = {
+        g_build_filename(PACKAGE_CONFIG_DIR, PACKAGE, NULL),
+        g_build_filename(srn_get_executable_dir(), "etc", PACKAGE, NULL),
+        g_build_filename(srn_get_executable_dir(), "..", "etc", PACKAGE, NULL),
+        srn_get_executable_dir(),
+        NULL
+    };
+
+    path = srn_find_file_in_prefix(prefix, name);
+
+    strfreev(prefix);
+    return path;
+}
+
+static char *srn_try_to_find_user_file(const char *name){
+    char *path;
+    char *prefix[] = {
+        g_build_filename(g_get_user_config_dir(), PACKAGE, NULL),
+        srn_get_executable_dir(),
+        NULL
+    };
+
+    path = srn_find_file_in_prefix(prefix, name);
+
+    strfreev(prefix);
+    return path;
+}
+
 /**
  * @brief srn_get_theme_file returns the path of theme file with specified 
name.
  *  If the file is not found, returns NULL.
@@ -50,30 +150,38 @@
  * @return NULL or path to the theme file, must be freed by g_free.
  */
 char *srn_get_theme_file(const char *name){
+    char *suffix;
     char *path;
 
-    path = g_build_filename(PACKAGE_DATA_DIR, PACKAGE, "themes", name, NULL);
-
-    if (g_file_test(path, G_FILE_TEST_EXISTS)){
-        return path;
+    suffix = g_build_filename("themes", name, NULL);
+    if (!suffix){
+        return NULL;
     }
 
-    g_free(path);
-    return NULL;
+    path = srn_try_to_find_data_file(suffix);
+
+    g_free(suffix);
+    return path;
 }
 
 char *srn_get_user_config_file(){
     char *path;
     SrnRet ret;
 
-    path = g_build_filename(g_get_user_config_dir(), PACKAGE, "srain.cfg", 
NULL);
-
-    ret = create_file_if_not_exist(path);
-    if (!RET_IS_OK(ret)){
-        WARN_FR("Failed to create user configuration file: %1$s", 
RET_MSG(ret));
-
-        g_free(path);
-        return NULL;
+    path = srn_try_to_find_data_file("srain.cfg");
+    if (!path){
+        path = g_build_filename(g_get_user_config_dir(), PACKAGE, "srain.cfg", 
NULL);
+        if (!path) {
+            return NULL;
+        }
+
+        ret = create_file_if_not_exist(path);
+        if (!RET_IS_OK(ret)){
+            WARN_FR("Failed to create user configuration file: %1$s", 
RET_MSG(ret));
+
+            g_free(path);
+            return NULL;
+        }
     }
 
     return path;
@@ -82,27 +190,36 @@
 char *srn_get_system_config_file(){
     char *path;
 
-    path = g_build_filename(PACKAGE_CONFIG_DIR, PACKAGE, "builtin.cfg", NULL);
-
-    if (g_file_test(path, G_FILE_TEST_EXISTS)){
-        return path;
+    path = srn_try_to_find_config_file("builtin.cfg");
+    if (!path){
+        // System configuration file should always exist
+        WARN_FR("'%s' not found", path);
     }
 
-    // System configuration file should always exist
-    WARN_FR("'%s' not found", path);
-
-    g_free(path);
-    return NULL;
+    return path;
 }
 
 // FIXME: actually it only create the dir.
 char *srn_create_log_file(const char *srv_name, const char *fname){
     char *path;
+    char *tmp;
     SrnRet ret;
 
-    // $XDG_DATA_HOME/srain/logs/<srv_name>/<fname>
-    path = g_build_filename(g_get_user_data_dir(),
-            PACKAGE, "logs", srv_name, fname, NULL);
+    tmp = srn_try_to_find_user_file("logs");
+    if (tmp){
+        // Directory 'logs' exists
+        path = g_build_filename(tmp, srv_name, fname, NULL);
+        g_free(tmp);
+        tmp = NULL;
+    } else {
+        // $XDG_DATA_HOME/srain/logs/<srv_name>/<fname>
+        path = g_build_filename(g_get_user_data_dir(), PACKAGE, "logs",
+                                srv_name, fname, NULL);
+    }
+
+    if (!path){
+        return NULL;
+    }
 
     ret = create_file_if_not_exist(path);
     if (!RET_IS_OK(ret)){
@@ -232,3 +349,51 @@
 
     return SRN_OK;
 }
+
+#ifdef _WIN32
+char *srn_get_executable_path() {
+   char rawPathName[MAX_PATH];
+   GetModuleFileNameA(NULL, rawPathName, MAX_PATH);
+   return g_build_filename(rawPathName, NULL);
+}
+
+char *srn_get_executable_dir() {
+    char *exePath = srn_get_executable_path();
+    char *executableDir = g_path_get_dirname(exePath);
+    g_free(exePath);
+    return executableDir;
+}
+
+#elif defined __linux__
+char *srn_get_executable_path() {
+   char rawPathName[PATH_MAX];
+   realpath(PROC_SELF_EXE, rawPathName);
+   return g_build_filename(rawPathName, NULL);
+}
+
+char *srn_get_executable_dir() {
+    char *exePath = srn_get_executable_path();
+    char *executableDir = g_path_get_dirname(exePath);
+    g_free(exePath);
+    return executableDir;
+}
+
+#elif defined __APPLE__
+char *srn_get_executable_path() {
+    char rawPathName[PATH_MAX];
+    char realPathName[PATH_MAX];
+    uint32_t rawPathSize = (uint32_t)sizeof(rawPathName);
+
+    if(!_NSGetExecutablePath(rawPathName, &rawPathSize)) {
+        realpath(rawPathName, realPathName);
+    }
+    return g_build_filename(realPathName, NULL);
+}
+
+char *srn_get_executable_dir() {
+    char *executablePath = srn_get_executable_path();
+    char *executableDir = g_path_get_dirname(executablePathStr);
+    g_free(executablePath);
+    return executableDir;
+}
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/srain-1.1.1/src/sui/sui_chat_buffer.c 
new/srain-1.1.3/src/sui/sui_chat_buffer.c
--- old/srain-1.1.1/src/sui/sui_chat_buffer.c   2020-06-27 06:31:18.000000000 
+0200
+++ new/srain-1.1.3/src/sui/sui_chat_buffer.c   2020-10-04 03:11:49.000000000 
+0200
@@ -133,9 +133,6 @@
 
     self = SUI_CHAT_BUFFER(object);
     sui_server_buffer_rm_buffer(self->server_buffer, SUI_BUFFER(self));
-
-    sui_user_list_clear(self->user_list);
-
     G_OBJECT_CLASS(sui_chat_buffer_parent_class)->finalize(object);
 }
 

++++++ Srain-no_implicit_declarations.patch ++++++
>From 00b152a3af6b65102e08b01faab74a1f17af99b2 Mon Sep 17 00:00:00 2001
From: Luigi Baldoni <[email protected]>
Date: Sun, 4 Oct 2020 11:05:38 +0200
Subject: [PATCH] Fix implicit-declaration error on some systems

---
 src/lib/path.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lib/path.c b/src/lib/path.c
index 2449072c..30611c68 100644
--- a/src/lib/path.c
+++ b/src/lib/path.c
@@ -37,6 +37,8 @@
 #include "i18n.h"
 #include "path.h"
 
+#include <stdlib.h>
+
 #ifdef _WIN32
 #include <windows.h>
 #include <Shlwapi.h>

Reply via email to