Hello,
I ported from kopete-kde3 button "Install into Samba" for initialize this 
protocol in samba. This button exist near host name in account widget, but it 
has none name and do nothing. After click it use bash script winpopup-install.

And also I fix sending messages and script winpopup-install.
I remove suffix .sh from scripts winpopup-install and winpopup-send because it 
use bash (not sh).

I try upload this patch to reviewboard, but it show me error:
The file '/trunk/KDE/kdenetwork/kopete/protocols/winpopup/winpopup-install' 
(r1007087) could not be found in the repository

I never seen this error before. Patch I generate with svn diff.

-- 
Pali Rohár
pali.ro...@gmail.com

Index: winpopup-send.sh
===================================================================
--- winpopup-send.sh	(revision 1007087)
+++ winpopup-send.sh	(working copy)
@@ -1,44 +0,0 @@
-#!/bin/bash
-PATH=/bin:/usr/bin/:/usr/local/bin
-
-# Check input
-[ -z "$1" -o -z "$2" ] && exit 1
-
-# Check if file is indeed a file and readable
-[ ! -f "$1" -o ! -r "$1" ] && exit 1
-
-KOPETE_RUNNING=x`ps -A|grep -e "kopete$"`
-
-if [ "$KOPETE_RUNNING" = "x" ]; then
-
-    if [ -z "$3" ]; then
-        THIS_SERVER=`uname -n`
-    else
-        THIS_SERVER="$3"
-    fi
-
-    if [ "$2" != "$THIS_SERVER" ]; then
-        echo -e "Kopete is currently not running.\nYour message was not delivered!" \
-            | smbclient -N -M $2
-    fi
-
-else
-
-    # Create a unique filename
-    filename="/var/lib/winpopup/`date +%s_%N`"
-
-    # the time...
-    TIME=`date --iso-8601=seconds`
-
-    # the message
-    MESSAGE=`cat "$1"`
-
-    # Put it into the file
-    echo -e "$2\n$TIME\n$MESSAGE" > $filename
-
-
-fi
-
-# Remove the message from samba
-rm -f "$1"
-
Index: winpopup-install
===================================================================
--- winpopup-install	(revision 1007087)
+++ winpopup-install	(working copy)
@@ -1,13 +1,25 @@
 #!/bin/bash
+PATH=/bin:/usr/bin/:/usr/local/bin
 
-PATH=/bin:/usr/bin
+# Check if first parameter script winpopup-send with path
+if [ -f "$1" ]; then
+	WPSEND=$1
+else
+	#Try find winpopup-send in $PATH
+	WPSEND=`which winpopup-send`
+	if [ "$WPSEND" == "" ]; then
+		echo "Cant find script winpopup-send"
+		echo "Run: $0 <script winpopup-send with path>"
+		exit 1
+	fi
+fi
 
 # Grab the full path to the smb.conf file
 i=`find /etc -name smb.conf`
 
 # Create new smb.conf file with updated message command line
 echo "[global]" > ~/smb.conf.new
-echo "   message command = $1 %s %m %t &" >> ~/smb.conf.new
+echo "   message command = $WPSEND %s %m %t &" >> ~/smb.conf.new
 cat $i | grep -v "message command = " | grep -v "\[global\]" >> ~/smb.conf.new
 
 # Backup the old file

Property changes on: winpopup-install
___________________________________________________________________
Added: svn:mergeinfo

Index: wpeditaccount.cpp
===================================================================
--- wpeditaccount.cpp	(revision 1007087)
+++ wpeditaccount.cpp	(working copy)
@@ -86,6 +86,8 @@
 		mSmbcPath->setUrl(tmpSmbcPath);
 	}
 
+	connect ( doInstallSamba, SIGNAL(clicked()), this, SLOT(installSamba()) );
+
 	show();
 }
 
Index: winpopup-install.sh
===================================================================
--- winpopup-install.sh	(revision 1007087)
+++ winpopup-install.sh	(working copy)
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-PATH=/bin:/usr/bin
-
-# Grab the full path to the smb.conf file
-i=`find /etc -name smb.conf`
-
-# Create new smb.conf file with updated message command line
-echo "[global]" > ~/smb.conf.new
-echo "   message command = $1 %s %m %t &" >> ~/smb.conf.new
-cat $i | grep -v "message command = " | grep -v "\[global\]" >> ~/smb.conf.new
-
-# Backup the old file
-mv -f $i "$i.old"
-
-# Move new file into place and reset permissions
-mv -f ~/smb.conf.new $i
-chown root:root $i
-chmod 644 $i
-
-# Create a winpopup directory somewhere "safe"
-#rm -rf /var/lib/winpopup --- a bit strong?
-if [ ! -d /var/lib/winpopup ]; then
-	mkdir -p /var/lib/winpopup
-fi
-
-chmod 0777 /var/lib/winpopup
-
-# This is to help if somebody grades up from the old behavior
-if [ -n "`ls -A /var/lib/winpopup/`" ]; then
-	chmod 666 /var/lib/winpopup/*
-fi
-
-rm -f /var/lib/winpopup/message
-
-# Force Samba to reread configuration
-killall -HUP smbd
Index: libwinpopup/libwinpopup.cpp
===================================================================
--- libwinpopup/libwinpopup.cpp	(revision 1007087)
+++ libwinpopup/libwinpopup.cpp	(working copy)
@@ -159,7 +159,7 @@
 	currentGroup.clear();
 
 	// for Samba 3
-	readGroupsProcess = new QProcess;
+	readGroupsProcess = new KProcess;
 	QStringList args;
 	args << "-N" << "-g" << "-L" << Host;
 
@@ -320,12 +320,16 @@
  */
 void WinPopupLib::sendMessage(const QString &Body, const QString &Destination)
 {
-	QProcess *sender = new QProcess(this);
+	KProcess *sender = new KProcess(this);
 	QStringList args;
 	args << "-M" << Destination << "-N";
 	sender->start(smbClientBin, args);
+	sender->waitForStarted();
+	//TODO: check if we can write message
 	sender->write(Body.trimmed().toLocal8Bit());
 	sender->closeWriteChannel();
+	sender->waitForFinished();
+	delete sender;
 }
 
 void WinPopupLib::settingsChanged(const QString &smbClient, int groupFreq)

Property changes on: winpopup-send
___________________________________________________________________
Added: svn:mergeinfo

Index: ui/wpeditaccountbase.ui
===================================================================
--- ui/wpeditaccountbase.ui	(revision 1007087)
+++ ui/wpeditaccountbase.ui	(working copy)
@@ -94,6 +94,9 @@
               <property name="whatsThis" >
                <string>Install support into Samba to enable this service.</string>
               </property>
+              <property name="text" >
+               <string>I&amp;nstall Into Samba</string>
+              </property>
              </widget>
             </item>
            </layout>
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 1007087)
+++ CMakeLists.txt	(working copy)
@@ -45,7 +45,7 @@
 ########### install files ###############
 
 install( FILES kopete_wp.desktop  DESTINATION ${SERVICES_INSTALL_DIR})
-install(PROGRAMS winpopup-send.sh winpopup-install.sh  DESTINATION ${BIN_INSTALL_DIR})
+install(PROGRAMS winpopup-send winpopup-install  DESTINATION ${BIN_INSTALL_DIR})
 
 
 

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to