[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kopete/dev-0.12/kopete/protocols/winpopup
From:       Gerd Fleischer <gerdfleischer () web ! de>
Date:       2006-02-05 9:29:20
Message-ID: 1139131760.728695.27902.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 505884 by geflei:

tell other people that we are not running, cleanups

 M  +2 -0      libwinpopup/libwinpopup.cpp  
 M  +1 -1      ui/wpeditaccountbase.ui  
 M  +1 -1      winpopup-install.sh  
 M  +26 -18    winpopup-send.sh  
 M  +3 -1      wpaccount.cpp  
 M  +1 -2      wpaddcontact.cpp  
 M  +3 -5      wpaddcontact.h  
 M  +6 -3      wpeditaccount.cpp  
 M  +1 -1      wpeditaccount.h  
 M  +2 -2      wpprotocol.cpp  


--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/libwinpopup/libwinpopup.cpp \
#505883:505884 @@ -227,6 +227,8 @@
 {
 //	kdDebug(14170) << "check for new Messages: " << this << endl;
 
+///TODO: use KDirWatch, KDirLister or something like
+
 	if (!checkMessageDir()) return; // Restart timer if false? GF
 
 	QDir dir(WP_POPUP_DIR);
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/ui/wpeditaccountbase.ui \
#505883:505884 @@ -155,7 +155,7 @@
 &lt;br&gt;
 "Install into Samba" is a simple method to create the directory for the temporary \
message files and configure your samba server.&lt;br&gt;  However, the recommended \
way is to ask your administrator to create this directory ('mkdir -p -m 0777 \
                /var/lib/winpopup') and add
-'message command = _PATH_TO_/winpopup-send.sh %s %m &amp;' (substitute _PATH_TO_ by \
the real path) to your smb.conf [global]-section.</string> +'message command = \
_PATH_TO_/winpopup-send.sh %s %m %t &amp;' (substitute _PATH_TO_ by the real path) to \
your smb.conf [global]-section.</string>  </property>
                                 <property name="alignment">
                                     <set>WordBreak|AlignTop</set>
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/winpopup-install.sh \
#505883:505884 @@ -7,7 +7,7 @@
 
 # Create new smb.conf file with updated message command line
 echo "[global]" > ~/smb.conf.new
-echo "   message command = $1 %s %m &" >> ~/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
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/winpopup-send.sh \
#505883:505884 @@ -1,5 +1,5 @@
 #!/bin/sh
-PATH=/bin
+PATH=/bin:/usr/bin/:/usr/local/bin
 
 # Check input
 [ -z "$1" -o -z "$2" ] && exit 1
@@ -7,29 +7,37 @@
 # Check if file is indeed a file and readable
 [ ! -f "$1" -o ! -r "$1" ] && exit 1
 
-# Create a unique filename
-filename="/var/lib/winpopup/`date +%s_%N`"
+KOPETE_RUNNING=x`ps -A|grep -e "kopete$"`
 
-# Put the remote host name into the file
-echo "$2" > $filename
+if [ "$KOPETE_RUNNING" = "x" ]; then
 
-# And the time...
-echo `date --iso-8601=seconds` >> $filename
+    if [ -z "$3" ]; then
+        THIS_SERVER=`uname -n`
+    else
+        THIS_SERVER="$3"
+    fi
 
-# Finally the message
-#cat "$1" | tr "\000" "\012" >> $filename
-# This tr eats the messages? GF
-cat "$1" >> $filename
+    if [ "$2" != "$THIS_SERVER" ]; then
+        echo -e "Kopete is currently not running.\nYour message was not delivered!" \
\ +            | smbclient -N -M $2
+    fi
 
-# Make sure the file is owned by nobody and is readable
-#chown nobody:nogroup $filename
-# Just to be sure
-#chmod 666 $filename
+else
 
-# Move the new message file into the pickup place
-# Doesn't this overwrite short before received messages? GF
-#mv -f $filename /var/lib/winpopup/message
+    # Create a unique filename
+    filename="/var/lib/winpopup/`date +%s_%N`"
 
+    # Put the remote host name into the file
+    echo "$2" > $filename
+
+    # And the time...
+    echo `date --iso-8601=seconds` >> $filename
+
+    # Finally the message
+    cat "$1" >> $filename
+
+fi
+
 # Remove the message from samba
 rm -f "$1"
 
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/wpaccount.cpp \
#505883:505884 @@ -35,10 +35,12 @@
 class KPopupMenu;
 
 WPAccount::WPAccount(WPProtocol *parent, const QString &accountID, const char *name)
-	: Kopete::Account(parent, accountID, name), mProtocol(parent)
+	: Kopete::Account(parent, accountID, name)
 {
 //	kdDebug(14170) <<  "WPAccount::WPAccount()" << endl;
 
+	mProtocol = WPProtocol::protocol();
+
 	// we need this before initActions
 	Kopete::MetaContact *myself = Kopete::ContactList::self()->myself();
 	setMyself( new WPContact(this, accountID, myself->displayName(), myself) );
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/wpaddcontact.cpp \
#505883:505884 @@ -36,7 +36,7 @@
 #include "wpaccount.h"
 #include "wpaddcontact.h"
 
-WPAddContact::WPAddContact(WPProtocol *owner, WPAccount *newAccount, QWidget \
*parent, const char *name): AddContactPage(parent, name) \
+WPAddContact::WPAddContact(QWidget *parent, WPAccount *newAccount, const char *name) \
: AddContactPage(parent, name)  {
 //	kdDebug(14170) << "WPAddContact::WPAddContact(<owner>, " << newAccount << ", \
<parent>, " << name << ")" << endl;  
@@ -45,7 +45,6 @@
 	connect(theDialog->mHostGroup, SIGNAL(activated(const QString &)), this, \
SLOT(slotSelected(const QString &)));  connect(theDialog->mRefresh, \
SIGNAL(clicked()), this, SLOT(slotUpdateGroups()));  theDialog->show();
-	theProtocol = owner;
 	theAccount = newAccount;
 
 	slotUpdateGroups();
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/wpaddcontact.h \
#505883:505884 @@ -18,8 +18,6 @@
 #ifndef WPADDCONTACT_H
 #define WPADDCONTACT_H
 
-// Local Includes
-
 // Kopete Includes
 #include <addcontactpage.h>
 
@@ -27,7 +25,8 @@
 
 // KDE Includes
 
-class WPProtocol;
+// Local Includes
+
 class WPAccount;
 class WPAddContactBase;
 namespace Kopete { class MetaContact; }
@@ -37,12 +36,11 @@
 	Q_OBJECT
 
 private:
-	WPProtocol *theProtocol;
 	WPAccount *theAccount;
 	WPAddContactBase *theDialog;
 
 public:
-	WPAddContact(WPProtocol *owner, WPAccount *newAccount, QWidget *parent = 0, const \
char *name = 0); +	WPAddContact(QWidget *parent, WPAccount *newAccount, const char \
*name = 0);  ~WPAddContact();
 
 	virtual bool validateData();
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/wpeditaccount.cpp \
#505883:505884 @@ -41,12 +41,15 @@
 // Local Includes
 #include "wpaccount.h"
 #include "wpeditaccount.h"
+#include "wpprotocol.h"
 
-WPEditAccount::WPEditAccount(WPProtocol *protocol, Kopete::Account *theAccount, \
                QWidget *parent, const char *name)
-	: WPEditAccountBase(parent), KopeteEditAccountWidget(theAccount), \
mProtocol(protocol) +WPEditAccount::WPEditAccount(QWidget *parent, Kopete::Account \
*theAccount) +	: WPEditAccountBase(parent), KopeteEditAccountWidget(theAccount)
 {
-	kdDebug(14170) << "WPEditAccount::WPEditAccount(<protocol>, <theAccount>, <parent>, \
" << name << ")"; +	kdDebug(14170) << "WPEditAccount::WPEditAccount(<parent>, \
<theAccount>)";  
+	mProtocol = WPProtocol::protocol();
+
 	if(account()) {
 		mHostName->setText(account()->accountId());
 		mAutoConnect->setChecked(account()->excludeConnect());
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/wpeditaccount.h \
#505883:505884 @@ -41,7 +41,7 @@
 	WPAccount *mAccount;
 
 public:
-	WPEditAccount(WPProtocol *protocol, Kopete::Account *theAccount, QWidget *parent = \
0, const char *name = 0); +	WPEditAccount(QWidget *parent, Kopete::Account \
*theAccount);  
 	virtual bool validateData();
 	void writeConfig();
--- branches/work/kopete/dev-0.12/kopete/protocols/winpopup/wpprotocol.cpp \
#505883:505884 @@ -86,7 +86,7 @@
 {
 //	kdDebug(14170) << "WPProtocol::createAddContactWidget(<parent>, " << theAccount \
<< ")" << endl;  
-	return new WPAddContact(this, dynamic_cast<WPAccount *>(theAccount), parent);
+	return new WPAddContact(parent, dynamic_cast<WPAccount *>(theAccount));
 }
 
 Kopete::Contact *WPProtocol::deserializeContact( Kopete::MetaContact *metaContact,
@@ -113,7 +113,7 @@
 
 KopeteEditAccountWidget *WPProtocol::createEditAccountWidget(Kopete::Account \
*account, QWidget *parent)  {
-	return new WPEditAccount(this, account, parent);
+	return new WPEditAccount(parent, account);
 }
 
 Kopete::Account *WPProtocol::createNewAccount(const QString &accountId)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic