[44632] trunk/dports/net/psi

rowue at macports.org rowue at macports.org
Wed Dec 31 19:13:08 PST 2008


Revision: 44632
          http://trac.macports.org/changeset/44632
Author:   rowue at macports.org
Date:     2008-12-31 19:13:08 -0800 (Wed, 31 Dec 2008)
Log Message:
-----------
Added files

Added Paths:
-----------
    trunk/dports/net/psi/files/
    trunk/dports/net/psi/files/patch-configure.diff
    trunk/dports/net/psi/files/patch-src-about.ui.diff
    trunk/dports/net/psi/files/patch-src-main.cpp.diff
    trunk/dports/net/psi/files/patch-src-main.h.diff
    trunk/dports/net/psi/files/patch-src-options-opt_plugins.cpp.diff
    trunk/dports/net/psi/files/patch-src-options-opt_plugins.h.diff
    trunk/dports/net/psi/files/patch-src-pluginmanager.cpp.diff
    trunk/dports/net/psi/files/patch-src-pluginmanager.h.diff
    trunk/dports/net/psi/files/patch-src-psiaccount.cpp.diff
    trunk/dports/net/psi/files/patch-src-psichatdlg.cpp.diff
    trunk/dports/net/psi/files/patch-src-psichatdlg.h.diff
    trunk/dports/net/psi/files/patch-src-psiplugin.h.diff

Added: trunk/dports/net/psi/files/patch-configure.diff
===================================================================
--- trunk/dports/net/psi/files/patch-configure.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-configure.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,105 @@
+--- configure	2008-12-30 16:39:07.000000000 +0100
++++ configure	2008-12-30 16:49:59.000000000 +0100
+@@ -40,6 +40,8 @@
+   --with-aspell-inc=[path]     Path to Aspell include files
+   --with-aspell-lib=[path]     Path to Aspell library files
+   --enable-tests               Enable use of Tests
++  --disable-plugins            Disable use of Plugins
++  --enable-plugins             Enable Psi Plugin support
+   --enable-debug               Enable debugging support
+ 
+ EOT
+@@ -242,6 +244,16 @@
+ 			shift
+ 			;;
+ 
++        --disable-plugins)
++            QC_DISABLE_plugins="Y"
++            shift
++            ;;
++
++        --enable-plugins)
++            QC_ENABLE_PLUGINS="Y"
++            shift
++            ;;
++
+ 		--enable-debug)
+ 			QC_ENABLE_DEBUG="Y"
+ 			shift
+@@ -285,6 +297,8 @@
+ echo QC_WITH_ASPELL_INC=$QC_WITH_ASPELL_INC
+ echo QC_WITH_ASPELL_LIB=$QC_WITH_ASPELL_LIB
+ echo QC_ENABLE_tests=$QC_ENABLE_tests
++echo QC_DISABLE_plugins=$QC_DISABLE_plugins
++echo QC_ENABLE_PLUGINS=$QC_ENABLE_PLUGINS
+ echo QC_ENABLE_DEBUG=$QC_ENABLE_DEBUG
+ echo
+ fi
+@@ -1061,6 +1075,48 @@
+ 		return true;
+ 	}
+ };
++#line 1 "plugins.qcm"
++/*
++-----BEGIN QCMOD-----
++name: Plugins
++arg: enable-plugins,Enable Psi Plugin support
++
++-----END QCMOD-----
++*/
++
++//----------------------------------------------------------------------------
++// qc_plugins
++//----------------------------------------------------------------------------
++class qc_plugins : public ConfObj
++{
++public:
++   qc_plugins(Conf *c) : ConfObj(c) {}
++   QString name() const { return "Plugins"; }
++   QString shortname() const { return "Plugins"; }
++   bool exec()
++   {
++       QString s;
++      
++       // Check if Jingle was enabled explicitly
++       s = conf->getenv("QC_ENABLE_PLUGINS");
++       if(s.isEmpty())
++           return false;
++       
++       conf->addDefine("PSI_PLUGINS");
++       
++       // Finish
++       conf->addExtra("CONFIG += psi_plugins");                              
++
++       qWarning("");
++       qWarning("");
++       qWarning("        !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!");
++       qWarning("        PLUGIN SUPPORT IS STILL UNFINISHED !!!");
++       qWarning("        THE PLUGIN INTERFACE /WILL/ CHANGE !!!");
++       qWarning("        USE AT YOUR OWN RISK !!!");
++			 
++       return true;
++   }
++};
+ #line 1 "tests.qcm"
+ /*
+ -----BEGIN QCMOD-----
+@@ -1185,6 +1241,9 @@
+     o = new qc_tests(conf);
+     o->required = false;
+     o->disabled = true;
++    o = new qc_plugins(conf);
++    o->required = false;
++    o->disabled = false;
+     o = new qc_debug(conf);
+     o->required = true;
+     o->disabled = false;
+@@ -2176,6 +2235,8 @@
+ export QC_WITH_ASPELL_INC
+ export QC_WITH_ASPELL_LIB
+ export QC_ENABLE_tests
++export QC_DISABLE_plugins
++export QC_ENABLE_PLUGINS
+ export QC_ENABLE_DEBUG
+ export QC_VERBOSE
+ rm -rf .qconftemp

Added: trunk/dports/net/psi/files/patch-src-about.ui.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-about.ui.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-about.ui.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,17 @@
+Index: src/about.ui
+===================================================================
+--- src/about.ui	(Revision 1195)
++++ src/about.ui	(Arbeitskopie)
+@@ -101,8 +101,11 @@
+          </property>
+          <property name="text" >
+           <string>A cross-platform Jabber client designed for the Jabber power user.&lt;br>
+-&lt;br>
++	  &lt;br>
+ Copyright © 2001-2008 The Psi Team.&lt;br>
++
++This version of Psi has been been patched by Timo Engel (timo-e at freenet.de)
++
+ </string>
+          </property>
+          <property name="textFormat" >

Added: trunk/dports/net/psi/files/patch-src-main.cpp.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-main.cpp.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-main.cpp.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,14 @@
+Index: src/main.cpp
+===================================================================
+--- src/main.cpp	(Revision 1195)
++++ src/main.cpp	(Arbeitskopie)
+@@ -265,6 +265,9 @@
+ 
+ void PsiMain::bail()
+ {
++#ifdef PSI_PLUGINS
++	PluginManager::instance()->quitProgram();
++#endif
+ 	if(pcon) {
+ 		delete pcon;
+ 		pcon = 0;

Added: trunk/dports/net/psi/files/patch-src-main.h.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-main.h.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-main.h.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,13 @@
+Index: src/main.h
+===================================================================
+--- src/main.h	(Revision 1195)
++++ src/main.h	(Arbeitskopie)
+@@ -24,6 +24,8 @@
+ #include <QString>
+ #include <QObject>
+ 
++#include "pluginmanager.h"
++
+ class PsiCon;
+ 
+ class PsiMain : public QObject

Added: trunk/dports/net/psi/files/patch-src-options-opt_plugins.cpp.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-options-opt_plugins.cpp.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-options-opt_plugins.cpp.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,46 @@
+Index: src/options/opt_plugins.cpp
+===================================================================
+--- src/options/opt_plugins.cpp	(Revision 1195)
++++ src/options/opt_plugins.cpp	(Arbeitskopie)
+@@ -53,23 +53,21 @@
+ 	return w;
+ }
+ 
+-void OptionsTabPlugins::applyOptions(Options *opt)
++void OptionsTabPlugins::applyOptions()
+ {
+ 	if ( !w )
+ 		return;
+ 
+ 	OptPluginsUI *d = (OptPluginsUI *)w;
+ 	Q_UNUSED(d);
+-	Q_UNUSED(opt);
+ }
+ 
+-void OptionsTabPlugins::restoreOptions(const Options *opt)
++void OptionsTabPlugins::restoreOptions()
+ {
+ 	if ( !w )
+ 		return;
+ 
+ 	OptPluginsUI *d = (OptPluginsUI *)w;
+-	Q_UNUSED(opt);
+ 	Q_UNUSED(d);
+ }
+ 
+@@ -104,6 +102,15 @@
+ 		.arg(PluginManager::instance()->shortName(d->cb_plugins->currentText()));
+ 	bool value=d->cb_loadPlugin->isChecked(); 
+ 	PsiOptions::instance()->setOption(option, value);
++	if ( value) {
++		PluginManager::instance()->loadEnabledPlugins();
++		pluginSelected(0);
++	}
++	else {
++		delete d->pluginOptions;
++		PluginManager::instance()->unloadPlugin( d->cb_plugins->currentText());
++		d->pluginOptions = new QLabel(tr("This plugin has no user configurable options"));
++	}
+ }
+ 
+ void OptionsTabPlugins::pluginSelected(int index)

Added: trunk/dports/net/psi/files/patch-src-options-opt_plugins.h.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-options-opt_plugins.h.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-options-opt_plugins.h.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,15 @@
+Index: src/options/opt_plugins.h
+===================================================================
+--- src/options/opt_plugins.h	(Revision 1195)
++++ src/options/opt_plugins.h	(Arbeitskopie)
+@@ -14,8 +14,8 @@
+ 	~OptionsTabPlugins();
+ 
+ 	QWidget *widget();
+-	void applyOptions(Options *opt);
+-	void restoreOptions(const Options *opt);
++	void applyOptions();
++	void restoreOptions();
+ 
+ private:
+ 	QWidget *w;

Added: trunk/dports/net/psi/files/patch-src-pluginmanager.cpp.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-pluginmanager.cpp.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-pluginmanager.cpp.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,257 @@
+Index: src/pluginmanager.cpp
+===================================================================
+--- src/pluginmanager.cpp	(Revision 1195)
++++ src/pluginmanager.cpp	(Arbeitskopie)
+@@ -7,6 +7,7 @@
+ #include "userlist.h"
+ #include "applicationinfo.h"
+ #include "psioptions.h"
++#include "psiaccount.h"
+ #include <QtCrypto>
+ #include "xmpp_client.h"
+ 
+@@ -71,6 +72,7 @@
+  */
+ void PluginManager::optionChanged(const QString& option)
+ {
++	Q_UNUSED(option);
+ 	//QString("%1.%2").arg(loadOptionPrefix).arg(shortNames_[plugin]);
+ }
+ 
+@@ -164,12 +166,17 @@
+ 	plugins_.insert( plugin->name(), plugin );
+ 	
+ 	qDebug() << "connecting to plugin " << plugin->name();
++	connect(plugin, SIGNAL(sendStanza(const QString&, const QString&)),
++		this,   SLOT(sendStanza(const QString&, const QString&)));
+ 	connect( plugin, SIGNAL(sendStanza(const PsiAccount*, const QDomElement&)), this, SLOT(sendStanza(const PsiAccount*, const QDomElement&)));
+ 	connect( plugin, SIGNAL(sendStanza(const PsiAccount*, const QString&)), this, SLOT(sendStanza(const PsiAccount*, const QString&)));
+ 	connect( plugin, SIGNAL(setPluginOption( const QString&, const QVariant& )), this, SLOT( setPluginOption( const QString&, const QVariant& )));
+ 	connect( plugin, SIGNAL(getPluginOption( const QString&, QVariant&)), this, SLOT( getPluginOption( const QString&, QVariant&)));
+ 	connect( plugin, SIGNAL(setGlobalOption( const QString&, const QVariant& )), this, SLOT( setGlobalOption( const QString&, const QVariant& )));
+ 	connect( plugin, SIGNAL(getGlobalOption( const QString&, QVariant&)), this, SLOT( getGlobalOption( const QString&, QVariant&)));
++	connect(plugin, SIGNAL(getHomeDir(QString&)),
++		this, SLOT(getHomeDir(QString&)));
++	plugin->init();
+ 	return true;
+ }
+ 
+@@ -274,6 +281,9 @@
+ 		QDir dir(d);
+ 		foreach(QString file, dir.entryList()) {
+ 		  	file=dir.absoluteFilePath(file);
++		  	if (file.endsWith("..") || file.endsWith(".") ) {
++		  		continue;
++		  	}
+ 			qWarning(qPrintable(QString("Found plugin: %1").arg(file)));
+ 			if ( !loaders_.contains(file) ) { 
+ 				loadPlugin(file);
+@@ -341,7 +351,8 @@
+  */
+ void PluginManager::getPluginOption( const QString& option, QVariant& value)
+ {
+-	
++	Q_UNUSED(option);
++	Q_UNUSED(value);
+ }
+ 
+ /**
+@@ -373,17 +384,82 @@
+ 	else
+ 		qDebug("not valid option");
+ }
+-	
+-void PluginManager::message(PsiAccount* account, const XMPP::Jid& from, const UserListItem* ul, const QString& message)
++
++
++
++QList<QAction*> PluginManager::getChatDlgMenuEntries(QWidget* parent, 
++                                                     PsiAccount* account,
++					           						 const XMPP::Jid& otherjid)
+ {
+-	QString fromString=QString("%1").arg(from.full());
++	const QString accountString = QString("%1").arg(account->jid().full());
++	const QString otherJidString = QString("%1").arg(otherjid.full());
++	QList<QAction*> res;
++ 	foreach(PsiPlugin* plugin, plugins_.values() ) 
++	{
++		QAction* m = plugin->getChatDlgMenuEntry(parent, accountString,
++											     otherJidString);
++		if (m) {
++			res.append(m);
++		}
++	}
++	return res;
++}
++
++
++
++/**
++ * incomingMessage. Function is only for non-HTML messages.
++ */
++QString PluginManager::incomingMessage(PsiAccount* account, const XMPP::Jid& from, 
++	QString message) {
++	const QString toString = QString("%1").arg(account->jid().full());
++	const QString fromString=QString("%1").arg(from.full());
++	//qDebug() << "pluginmanager: incomming message from " << fromString 
++	//	 << " to " << toString;
+ 	qDebug() << "message from" << fromString;
+ 	foreach(PsiPlugin* plugin, plugins_.values() ) {
+-		plugin->message( account, message , fromString , from.full() );
++		message = plugin->incomingMessage(fromString, toString, message );
++		//qDebug() << plugin->shortName() << " returned: " << endl
++		//	<< message << "\n--\n";
+ 	}
++	//qDebug() << "PluginManager::incomingMessage:\n" << message << endl << "--";
++	return message;
+ }
+ 
+ /**
++ * incommingMessage with HTML content.
++ */
++HTMLElement PluginManager::incomingMessage(PsiAccount* account, const XMPP::Jid& from,
++                                           HTMLElement htmlMessage)
++{
++	const QString toString = QString("%1").arg(account->jid().full());
++	const QString fromString=QString("%1").arg(from.full());
++	//qDebug() << "pluginmanager: incomming message from " << fromString 
++	//	 << " to " << toString;
++	QDomElement body = htmlMessage.body();
++
++	//QString str;
++	//QTextStream ts( &str, IO_WriteOnly );
++	//body.save(ts, 8);
++	//qDebug() << "--\n" << str << "\n--\n\n";
++
++	foreach(PsiPlugin* plugin, plugins_.values())
++	{
++		body = plugin->incomingMessage(fromString, toString, body);
++		//qDebug() << plugin->shortName() << " returned: " << endl
++		//	<< message << "\n--\n";
++	}
++	
++	//QString str;
++	//QTextStream ts( &str, IO_WriteOnly );
++	//body.save(ts, 2);
++	//qDebug() << "pluginmanager: modified message:\n" << str << "\n--\n";
++		
++	htmlMessage.setBody(body);
++	return htmlMessage;
++}
++
++/**
+  * \brief Give each plugin the opportunity to process the incoming event
+  * 
+  * Each plugin is passed the event in turn. Any plugin may then modify the event
+@@ -429,7 +505,27 @@
+ 	clients_[account]->send(stanza);
+ }
+ 
++
+ /**
++ * Sends a stanza from the account spezified with fromJid.
++ *
++ */
++void PluginManager::sendStanza(const QString& fromJid, const QString& stanza) {
++	//qDebug() << "pluginmanager: sending stanza from account " << fromJid 
++	//	<< endl << stanza << "\n--";
++	QMapIterator<const PsiAccount*, XMPP::Client*> iterator(clients_);
++	while (iterator.hasNext()) {
++		iterator.next();
++		const PsiAccount* account = iterator.key();
++		if ( ! QString::compare(account->jid().full(), fromJid, Qt::CaseInsensitive)) {
++			clients_.value(account)->send(stanza);
++			break;
++		}
++	}
++}
++
++
++/**
+  * Tells the plugin manager about an XMPP::Client and the owning PsiAccount
+  */
+ void PluginManager::addAccount( const PsiAccount* account, XMPP::Client* client)
+@@ -447,6 +543,83 @@
+ 	return true;
+ }
+ 
++
++/**
++ * process an outgoing message
++ */
++QString PluginManager::outgoingMessage( PsiAccount* account, const XMPP::Jid& to, QString message ) {
++	const QString toString=QString("%1").arg(to.full());
++	const QString fromString = QString("%1").arg(account->jid().full());
++	//qDebug() << "pluginmanager: outgoing message from " << fromString << " to "
++	//	<< toString;
++	foreach(PsiPlugin* plugin, plugins_.values() ) {
++		message = plugin->outgoingMessage( fromString, toString, message );
++	}
++	return message;
++
++}
++
++/**
++ * Get the home-directory used by psi.
++ */
++void PluginManager::getHomeDir(QString& dir) {
++	dir = ApplicationInfo::homeDir();
++}
++
++/**
++ * A user from the roster has changed his status.
++ */
++void PluginManager::statusChanged(QString account, QString jid, QString resource, int prio, QString status, QString text) {
++	foreach(PsiPlugin* plugin, plugins_.values() ) {
++		plugin->statusChanged(account, jid, resource, prio, status, text);
++	}
++}
++
++/**
++ * A user from the roster has gone offline
++ */
++void PluginManager::contactOffline(QString account, QString jid) {
++	foreach(PsiPlugin* plugin, plugins_.values() ) {
++		plugin->contactOffline(account, jid);
++	}
++}
++
++/**
++ * A user from the roster has become available
++ */
++void PluginManager::contactOnline(QString account, QString jid) {
++	foreach(PsiPlugin* plugin, plugins_.values() ) {
++		plugin->contactOnline(account, jid);
++	}
++}
++
++/**
++ * A local account has succsesfully logged in
++ */
++void PluginManager::login(QString jid) {
++	foreach(PsiPlugin* plugin, plugins_.values() ) {
++		plugin->login(jid);
++	}
++
++}
++
++/**
++ * Account has logged of from the server.
++ */
++void PluginManager::logout(QString jid) {
++	foreach(PsiPlugin* plugin, plugins_.values() ) {
++		plugin->logout(jid);
++	}
++
++}
++
++void PluginManager::quitProgram() {
++	foreach(PsiPlugin* plugin, plugins_.values() ) {
++		plugin->quitProgram();
++	}
++}
++
++	
+ PluginManager* PluginManager::instance_ = NULL;
+ const QString PluginManager::loadOptionPrefix = "plugins.auto-load";
+ const QString PluginManager::pluginOptionPrefix = "plugins.options";

Added: trunk/dports/net/psi/files/patch-src-pluginmanager.h.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-pluginmanager.h.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-pluginmanager.h.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,67 @@
+Index: src/pluginmanager.h
+===================================================================
+--- src/pluginmanager.h	(Revision 1195)
++++ src/pluginmanager.h	(Arbeitskopie)
+@@ -4,9 +4,12 @@
+ #include <QtCore>
+ #include <QList>
+ #include <QMap>
++#include <QToolButton>
++#include <QAction>
+ 
+ #include "userlist.h"
+ #include "optionstree.h"
++#include "../iris/include/im.h"
+ 
+ class PsiPlugin;
+ 
+@@ -22,6 +25,8 @@
+ 
+ class QPluginLoader;
+ 
++using namespace XMPP;
++
+ class PluginManager : public QObject
+ {
+ 	Q_OBJECT
+@@ -30,9 +35,15 @@
+ 
+ 	QStringList availablePlugins();
+ 
++	QList<QAction*> getChatDlgMenuEntries(QWidget* parent, 
++									      PsiAccount* account, 
++	                                      const XMPP::Jid& otherjid);
++
+ 	void addAccount( const PsiAccount* account, XMPP::Client* client);
+-	void message( PsiAccount* account, const XMPP::Jid& from, 
+-	const UserListItem*, const QString& message );
++	QString incomingMessage( PsiAccount* account, const XMPP::Jid& from, QString message );
++	HTMLElement incomingMessage( PsiAccount* account, const XMPP::Jid& from, HTMLElement htmlMessage );
++	QString outgoingMessage( PsiAccount* account, const XMPP::Jid& from, QString message );
++				
+ 	bool loadPlugin( const QString& file );
+ 	void loadEnabledPlugins();
+ 	bool unloadPlugin( const QString& file );
+@@ -41,6 +52,13 @@
+ 	QString shortName( const QString& plugin );
+ 	QWidget* getOptionsWidget( const QString& plugin );
+ 	bool processEvent( const PsiAccount* account, QDomElement &event );
++	void statusChanged(QString account, QString jid, QString resource, int prio, QString status, 
++			   QString text);
++	void contactOffline(QString account, QString contact);
++	void contactOnline(QString account, QString contact);
++	void login(QString jid);
++	void logout(QString jid);
++	void quitProgram();
+ 	
+ 	const QVariant getGlobalOption(const QString& option);
+ 	
+@@ -80,6 +98,8 @@
+ 	void optionChanged(const QString& option);
+ 	void sendStanza( const PsiAccount* account, const QDomElement& stanza);
+ 	void sendStanza( const PsiAccount* account, const QString& stanza);
++	void sendStanza(const QString& fromJid, const QString& stanza);
++	void getHomeDir(QString&);
+ };
+ 
+ #endif

Added: trunk/dports/net/psi/files/patch-src-psiaccount.cpp.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-psiaccount.cpp.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-psiaccount.cpp.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,152 @@
+Index: src/psiaccount.cpp
+===================================================================
+--- src/psiaccount.cpp	(Revision 1195)
++++ src/psiaccount.cpp	(Arbeitskopie)
+@@ -1243,6 +1243,9 @@
+ // disconnect or stop reconnecting
+ void PsiAccount::logout(bool fast, const Status &s)
+ {
++#ifdef PSI_PLUGINS	
++	PluginManager::instance()->logout(jid().node() + "@" + jid().domain());
++#endif
+ 	if(!isActive())
+ 		return;
+ 
+@@ -1447,6 +1450,9 @@
+ 
+ 	// ask for roster
+ 	d->client->rosterRequest();
++#ifdef PSI_PLUGINS
++	PluginManager::instance()->login(jid().node() + "@" + jid().domain());
++#endif
+ }
+ 
+ void PsiAccount::cs_connectionClosed()
+@@ -1618,7 +1624,7 @@
+ 		str = tr("Broken security layer (SASL)");
+ 	else
+ 		str = tr("None");
+-	//printf("str[%s], reconn=%d\n", str.latin1(), reconn);
++//printf("str[%s], reconn=%d\n", str.latin1(), reconn);
+ 	*_str = str;
+ 	*_reconn = reconn;
+ }
+@@ -1864,6 +1870,11 @@
+ 		UserResourceList::Iterator rit = u->userResourceList().find(j.resource());
+ 		bool found = (rit == u->userResourceList().end()) ? false: true;
+ 		if(!found) {
++#ifdef PSI_PLUGINS
++			PluginManager::instance()->contactOnline(
++				jid().node() + "@" + jid().domain(),
++				j.node() + "@" + j.domain());
++#endif
+ 			popupType = PopupOnline;
+ 
+ 			UserResource ur(r);
+@@ -1949,6 +1960,15 @@
+ 			}
+ 		}
+ 	}
++#ifdef PSI_PLUGINS
++	PluginManager::instance()->statusChanged(
++		jid().node() + "@" + jid().domain(),
++		j.node() + "@" + j.domain(),
++		r.name(),
++		r.priority(),
++		r.status().show(),
++		r.status().status());
++#endif
+ }
+ 
+ void PsiAccount::client_resourceUnavailable(const Jid &j, const Resource &r)
+@@ -2019,6 +2039,11 @@
+ 		PsiGrowlNotifier::instance()->popup(this, PsiPopup::AlertOffline, j, r, u);
+ #endif
+ 	}
++#ifdef PSI_PLUGINS
++	PluginManager::instance()->contactOffline(
++		jid().node() + "@" + jid().domain(),
++		j.node() + "@" + j.domain());
++#endif
+ }
+ 
+ void PsiAccount::client_presenceError(const Jid &j, int, const QString &str)
+@@ -3493,6 +3518,14 @@
+ 		}
+ 	}
+ 
++#ifdef PSI_PLUGINS
++        if (! nm.body().isEmpty()) {
++                nm.setBody(PluginManager::instance()->outgoingMessage(this, nm.to(), nm.body()));
++        }
++#endif
++
++
++
+ 	d->client->sendMessage(nm);
+ 
+ 	// only toggle if not an invite or body is not empty
+@@ -3764,6 +3797,32 @@
+ 	//FIXME(KIS): must now cause the event to be recreated from this xml or such. Horrid. 	
+ #endif
+ 	
++#ifdef PSI_PLUGINS
++	if(e->type() == PsiEvent::Message) {
++		MessageEvent *me = (MessageEvent *)e;
++		Message msg = me->message();
++		UserListItem *ulItem=NULL;
++		if ( !ul.isEmpty() ) {
++			ulItem=ul.first();
++		}
++		
++		if (msg.containsHTML() && ! msg.html().text().isEmpty() ) {
++			HTMLElement htmlPart = PluginManager::instance()->incomingMessage(this,
++				msg.from(),
++				msg.html());
++			msg.setHTML(htmlPart, msg.lang());
++			msg.setBody(htmlPart.text());
++		}
++        	else if (! msg.body().isEmpty()) {
++                	msg.setBody( PluginManager::instance()->incomingMessage(this, 
++							      msg.from(),
++							      msg.body()));
++        	}
++		me->setMessage(msg);
++		e = me;
++	}
++#endif
++	
+ 	if(d->acc.opt_log && activationType != FromXml) {
+ 		if(e->type() == PsiEvent::Message || e->type() == PsiEvent::Auth) {
+ 			// don't log private messages
+@@ -3772,10 +3831,14 @@
+ 		}
+ 	}
+ 
++	
+ 	if(e->type() == PsiEvent::Message) {
++	
+ 		MessageEvent *me = (MessageEvent *)e;
+-		const Message &m = me->message();
++		Message msg = me->message();
++		const Message &m = msg;
+ 
++
+ 		// Pass message events to chat window
+ 		if ((m.containsEvents() || m.chatState() != StateNone) && m.body().isEmpty()) {
+ 			if (PsiOptions::instance()->getOption("options.messages.send-composing-events").toBool()) {
+@@ -3840,13 +3903,7 @@
+ 			// FIXME: handle message errors
+ 			//msg.text = QString(tr("<big>[Error Message]</big><br>%1").arg(plain2rich(msg.text)));
+ 		}
+-#ifdef PSI_PLUGINS
+-		UserListItem *ulItem=NULL;
+-		if ( !ul.isEmpty() )
+-			ulItem=ul.first();
+-		PluginManager::instance()->message(this,e->from(),ulItem,((MessageEvent*)e)->message().body());
+-#endif
+-	}
++}
+ 	else if(e->type() == PsiEvent::HttpAuth) {
+ 		playSound(PsiOptions::instance()->getOption("options.ui.notifications.sounds.system-message").toString());
+ 	}

Added: trunk/dports/net/psi/files/patch-src-psichatdlg.cpp.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-psichatdlg.cpp.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-psichatdlg.cpp.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,52 @@
+Index: src/psichatdlg.cpp
+===================================================================
+--- src/psichatdlg.cpp	(Revision 1195)
++++ src/psichatdlg.cpp	(Arbeitskopie)
+@@ -38,6 +38,7 @@
+ #include "userlist.h"
+ #include "jidutil.h"
+ #include "textutil.h"
++#include "pluginmanager.h"
+ 
+ PsiChatDlg::PsiChatDlg(const Jid& jid, PsiAccount* pa, TabManager* tabManager)
+ 		: ChatDlg(jid, pa, tabManager)
+@@ -189,6 +190,12 @@
+ 
+ 	act_compact_ = new IconAction(tr("Toggle Compact/Full size"), "psi/compact", tr("Toggle Compact/Full size"), 0, this);
+ 	connect(act_compact_, SIGNAL(activated()), SLOT(toggleSmallChat()));
++
++#ifdef PSI_PLUGINS
++	act_plugins_ = PluginManager::instance()->getChatDlgMenuEntries(this, 
++	                                                                account(),
++								        							jid());
++#endif
+ }
+ 
+ void PsiChatDlg::initToolBar()
+@@ -207,6 +214,12 @@
+ 	if (account()->voiceCaller()) {
+ 		ui_.toolbar->addAction(act_voice_);
+ 	}
++#ifdef PSI_PLUGINS
++	foreach (QAction* i, act_plugins_ )
++	{
++		ui_.toolbar->addAction(i);
++	}
++#endif
+ }
+ 
+ void PsiChatDlg::contextMenuEvent(QContextMenuEvent *)
+@@ -364,6 +377,13 @@
+ 
+ 	pm_settings_->addAction(act_info_);
+ 	pm_settings_->addAction(act_history_);
++#ifdef PSI_PLUGINS
++	foreach (QAction* a, act_plugins_)
++	{
++		pm_settings_->insertSeparator();
++		pm_settings_->addAction(a);
++	}
++#endif
+ }
+ 
+ void PsiChatDlg::updateCounter()

Added: trunk/dports/net/psi/files/patch-src-psichatdlg.h.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-psichatdlg.h.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-psichatdlg.h.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,15 @@
+Index: src/psichatdlg.h
+===================================================================
+--- src/psichatdlg.h	(Revision 1195)
++++ src/psichatdlg.h	(Arbeitskopie)
+@@ -69,7 +69,9 @@
+ 	IconAction* act_file_;
+ 	IconAction* act_compact_;
+ 	IconAction* act_voice_;
+-
++#ifdef PSI_PLUGINS
++	QList<QAction*> act_plugins_;
++#endif
+ 	bool smallChat_;
+ 	QDateTime lastMsgTime_;
+ };

Added: trunk/dports/net/psi/files/patch-src-psiplugin.h.diff
===================================================================
--- trunk/dports/net/psi/files/patch-src-psiplugin.h.diff	                        (rev 0)
+++ trunk/dports/net/psi/files/patch-src-psiplugin.h.diff	2009-01-01 03:13:08 UTC (rev 44632)
@@ -0,0 +1,178 @@
+Index: src/psiplugin.h
+===================================================================
+--- src/psiplugin.h	(Revision 1195)
++++ src/psiplugin.h	(Arbeitskopie)
+@@ -28,7 +28,9 @@
+ 
+ #include <QObject>
+ #include <QtCore>
+-#include <QDomNode>
++#include <QtXml>
++#include <QAction>
++#include <QToolButton>
+ 
+ class PsiAccount;
+ class QDomElement;
+@@ -53,6 +55,7 @@
+ 	 * \return Plugin name
+ 	 */
+ 	virtual QString name() const = 0;
++
+ 	/** \brief Short name for the plugin
+ 	 *	This is the short name of the plugin, used for options structures. 
+ 	 * It must consist of only alphanumerics (no spaces or punctuation).
+@@ -66,11 +69,40 @@
+ 	 * \return Plugin version string
+ 	 */
+ 	virtual QString version() const = 0; 
+-	
+-	virtual void message( const PsiAccount* account, const QString& message, const QString& fromJid, const QString& fromDisplay) 
+-	{Q_UNUSED(account);Q_UNUSED(message);Q_UNUSED(fromJid);Q_UNUSED(fromDisplay);}
+ 
+ 	/**
++	 * Allows the plugin to add a entry to the chat dialog menu.
++	 */
++	virtual QAction* getChatDlgMenuEntry(QWidget* parent,
++				       	     const QString& fromJid,
++				             const QString& toJid)
++	{Q_UNUSED(parent);Q_UNUSED(fromJid);Q_UNUSED(toJid);return NULL;}
++
++	/**
++	 * process incoming message
++	 */
++	virtual QString incomingMessage( const QString& fromJid,
++			      const QString& toJid, 
++			      const QString& message) 
++	{Q_UNUSED(fromJid);Q_UNUSED(toJid);Q_UNUSED(message);return NULL;}
++
++	/**
++	 * process incoming HTML message
++	 */
++	virtual QDomElement incomingMessage( const QString& fromJid,
++			      const QString& toJid, 
++			      const QDomElement& html) 
++	{Q_UNUSED(fromJid);Q_UNUSED(toJid);Q_UNUSED(html);return QDomElement();}
++
++	/** 
++	 * process outgoing message
++	 */
++	virtual QString outgoingMessage(const QString& fromJid, 
++					const QString& toJid, 
++					const QString& message)
++	{Q_UNUSED(fromJid);Q_UNUSED(toJid);Q_UNUSED(message); return NULL;}
++
++	/**
+ 	 * \brief Plugin options widget
+ 	 * This method is called by the Psi options system to retrieve
+ 	 * a widget containing the options for this plugin.
+@@ -81,10 +113,17 @@
+ 	virtual QWidget* options() {return NULL;} 
+ 	
+ 
+-	virtual bool processEvent( const PsiAccount* account, QDomNode &event ) {Q_UNUSED(account);Q_UNUSED(event);return true;}
++	/**
++	 * 
++	 *
++	 */
++	virtual bool processEvent( const PsiAccount* account, QDomNode &event ) 
++	{Q_UNUSED(account);Q_UNUSED(event);return true;}
+ 
++
+ 	/**
+-	 * Convenience method for plugins, allowing them to convert a QDomElement to a QString
++	 * Convenience method for plugins, allowing them to convert a QDomElement 
++	 * to a QString
+ 	 */
+ 	static QString toString(const QDomNode& xml)
+ 	{
+@@ -93,7 +132,53 @@
+ 		xml.save(stream, 0);
+ 		return QString(*stream.string());
+ 	}
+-	
++
++	/* initialize the plugin. called from the pluginmanager after loading */
++	virtual void init() {return;}
++
++	/* a contact has become available */
++	virtual void contactOnline(QString account, QString jid) {
++		Q_UNUSED(jid);
++		Q_UNUSED(account);
++		return;
++	}
++
++	/* a contact has become unavailable */
++	virtual void contactOffline(QString account, QString jid) {
++		Q_UNUSED(jid);
++		Q_UNUSED(account);
++		return;
++	}
++
++	/* a contact has changed its status */
++	virtual void statusChanged(QString account, QString jid, QString resource, int prio, 
++		QString status, QString text) {
++		Q_UNUSED(account);
++		Q_UNUSED(jid);
++		Q_UNUSED(resource);
++		Q_UNUSED(prio);
++		Q_UNUSED(status);
++		Q_UNUSED(text);
++		return;
++	}
++
++	/* account logged in */
++	virtual void login(QString jid) {
++		Q_UNUSED(jid);
++		return;
++	}
++
++	/* account went offline */
++	virtual void logout(QString jid) {
++		Q_UNUSED(jid);
++		return;
++	}
++
++	/* user want to exit psi */
++	virtual void quitProgram() {
++		return;
++	}
++
+ signals:
+ 	/**
+ 	 *	\brief Signals that the plugin wants to send a stanza.
+@@ -101,7 +186,7 @@
+ 	 * \param account The account name, as used by the plugin interface.
+ 	 * \param stanza The stanza to be sent.
+ 	 */
+-	//void sendStanza( const PsiAccount* account, const QDomElement& stanza);
++	void sendStanza( const PsiAccount* account, const QDomElement& stanza);
+ 
+ 	/**
+ 	 *	\brief Signals that the plugin wants to send a stanza.
+@@ -111,7 +196,14 @@
+ 	 */
+ 	void sendStanza( const PsiAccount* account, const QString& stanza);
+ 	
++	
+ 	/**
++	 * Send a stanza from the account with the jid fromJid.
++	 *
++	 */
++	void sendStanza( const QString& fromJid, const QString& stanza);
++	
++	/**
+ 	 * \brief Requests an item in the Psi menu for the plugin
+ 	 * 
+ 	 * \param label The text to be inserted in the menu
+@@ -162,6 +254,11 @@
+ 	 */
+ 	void getGlobalOption( const QString& option, QVariant& value);
+ 	
++	/**
++	 * Returns the home-directory used by psi
++	 */
++	void getHomeDir(QString& dir);
++
+ //protected:
+ 
+ 	
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081231/798f858d/attachment-0001.html>


More information about the macports-changes mailing list