File kdelibs3-iceauthority-to-xdg-home.patch of Package kdelibs3

diff -Naru kdelibs-3.5.10_orig/dcop/KDE-ICE/authutil.c kdelibs-3.5.10/dcop/KDE-ICE/authutil.c
--- kdelibs-3.5.10_orig/dcop/KDE-ICE/authutil.c	2005-09-10 17:27:21.000000000 +0900
+++ kdelibs-3.5.10/dcop/KDE-ICE/authutil.c	2019-07-22 15:46:38.916644695 +0900
@@ -84,7 +84,8 @@
 #ifdef _WIN32
     static char slashDotICEauthority[] = "\\.ICEauthority";
 #else
-    static char slashDotICEauthority[] = "/.ICEauthority";
+    /* removed dot */
+    static char slashDotICEauthority[] = "/ICEauthority";
 #endif
     char    	*name;
     static char	*buf;
@@ -98,7 +99,8 @@
     if ( name )
 	return (name);
 
-    name = getenv ("HOME");
+    /* check XDG_RUNTIME_DIR instead of HOME */
+    name = getenv ("XDG_RUNTIME_DIR");
 
     if (!name)
     {
diff -Naru kdelibs-3.5.10_orig/dcop/client/dcop.cpp kdelibs-3.5.10/dcop/client/dcop.cpp
--- kdelibs-3.5.10_orig/dcop/client/dcop.cpp	2005-09-10 17:27:22.000000000 +0900
+++ kdelibs-3.5.10/dcop/client/dcop.cpp	2019-07-22 17:04:31.036823035 +0900
@@ -52,7 +52,7 @@
 #include <X11/Xatom.h>
 #endif
 
-typedef QMap<QString, QString> UserList;
+typedef QMap<QString, uid_t> UserList;
 
 static DCOPClient* dcop = 0;
 
@@ -371,7 +371,7 @@
 }
 
 /**
- * Return a list of all users and their home directories.
+ * Return a list of all users and their UID.
  * Returns an empty list if /etc/passwd cannot be read for some reason.
  */
 static UserList userList()
@@ -380,7 +380,7 @@
 
     while( passwd* pstruct = getpwent() )
     {
-        result[ QString::fromLocal8Bit(pstruct->pw_name) ] = QFile::decodeName(pstruct->pw_dir);
+        result[ QString::fromLocal8Bit(pstruct->pw_name) ] = pstruct->pw_uid;
     }
 
     return result;
@@ -518,22 +518,20 @@
 
 	if( session == QuerySessions )
 	{
-	    QStringList sessions = dcopSessionList( it.key(), it.data() );
+	    QStringList sessions = dcopSessionList( it.key(), QString(getpwuid(it.data())->pw_dir) );
 	    if( sessions.isEmpty() )
 	    {
 		if( users.count() <= 1 )
 		{
 		    cout_ << "No active sessions";
-		    if( !( *it ).isEmpty() )
-			cout_ << " for user " << *it;
+		    cout_ << " for uid " << *it;
 		    cout_ << endl;
 		}
 	    }
 	    else
 	    {
 		cout_ << "Active sessions ";
-		if( !( *it ).isEmpty() )
-		    cout_ << "for user " << *it << " ";
+		cout_ << "for uid " << *it << " ";
 		cout_ << ":" << endl;
 
 		QStringList::Iterator sIt = sessions.begin();
@@ -554,7 +552,7 @@
 	if( users.count() > 1 || ( users.count() == 1 &&
 	    ( getenv( "DCOPSERVER" ) == 0 /*&& getenv( "DISPLAY" ) == 0*/ ) ) )
 	{
-	    sessions = dcopSessionList( it.key(), it.data() );
+	    sessions = dcopSessionList( it.key(), QString(getpwuid(it.data())->pw_dir) );
 	    if( sessions.isEmpty() )
 	    {
 		if( users.count() > 1 )
@@ -593,12 +591,13 @@
 	    ( getenv( "ICEAUTHORITY" ) == 0 || getenv( "DISPLAY" ) == 0 ) ) )
 	{
 	    // Check for ICE authority file and if the file can be read by us
-	    QString home = it.data();
-	    QString iceFile = it.data() + "/.ICEauthority";
+	    uid_t uid = it.data();
+	    QString iceFile;
+	    iceFile.sprintf("/run/user/%d/ICEauthority", uid);
 	    QFileInfo fi( iceFile );
 	    if( iceFile.isEmpty() )
 	    {
-		cerr_ << "WARNING: Cannot determine home directory for user "
+		cerr_ << "WARNING: Cannot determine XDG runtime directory for user "
 		     << it.key() << "!" << endl
 		     << "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
 		     << "calling dcop." << endl;
@@ -643,7 +642,8 @@
 	{
 	    if( !presetDCOPServer && !users.isEmpty() )
 	    {
-		QString dcopFile = it.data() + "/" + *sIt;
+		QString dcopFile;
+	        dcopFile.sprintf("%s/%s", getpwuid(it.data())->pw_dir, *sIt);
 		QFile f( dcopFile );
 		if( !f.open( IO_ReadOnly ) )
 		{