I started in a local git branch the new public D-Bus API for Kopete

In this email I attached the C++ header which implement the D-Bus interface 
and the xml generated by qdbuscpp2xml.

The current interface is fairy basic and it's close to the older DCOP 
interface, though much cleaner. It still need improvement.
it is also using MetaContact display name to reference a contact because it is
the simpliest way to address contacts for KDE 4.0.

I need feedback on the interface  and also I need to know if I can include 
this into KDE 4.0. That would be sad to ship Kopete without a D-Bus 
interface.
-- 
Michaël Larouche
KDE developer
--------------------------------------
Website: http://www.tehbisnatch.org/
MSN: [EMAIL PROTECTED]
IRC: irc.freenode.org/DarkShock
Jabber/email: [EMAIL PROTECTED]
/*
    kopetedbusinterface.h - Kopete D-Bus interface

    Copyright (c) 2007      by Michaël Larouche      <[EMAIL PROTECTED]>

    Kopete    (c) 2002-2007 by the Kopete developers <[email protected]>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/
#ifndef KOPETE_DBUSINTERFACE_H
#define KOPETE_DBUSINTERFACE_H

#include <QtCore/QObject>

class QStringList;

/**
 * @brief Public D-Bus interface for Kopete
 * @author Michaël Larouche <[EMAIL PROTECTED]>
 */
class KopeteDBusInterface : public QObject
{
	Q_OBJECT
	Q_CLASSINFO("D-Bus Interface", "org.kde.Kopete")
public:
	/**
	 * @brief Constructor
	 * @param parent QObject parent
	 */
	KopeteDBusInterface(QObject *parent = 0);
	/**
	 * @brief Destructor
	 */
	~KopeteDBusInterface();

public Q_SLOTS:
	/**
	 * @brief Return all contacts
	 * @return a list of all contacts display name
	 */
	QStringList contacts() const;
	
	/**
	 * @brief Get a filered list of contacts based on the filter
	 *
	 * Accetable filters are: online, reachable, filecapable.
	 * If no accepted filters are provived, it will return an
	 * empty list.
	 *
	 * @return list of filtered contacts
	 */
	QStringList contactsByFilter(const QString &filter) const;
	
	/**
	 * @brief Set the nickname for the given identity
	 *
	 * To set the nickname of the default identity, use an empty identityId
	 *
	 * @param nickName New nickname of the identity
	 * @param identityId Identity ID to modify. If empty, will use default identity.
	 */
	void setIdentityNickName(const QString &nickName, const QString &identityId = QString());

	/**
	 * @brief Set the avatar for the given identity
	 *
	 * To set the avatar of the default identity, use an empty identityId
	 *
	 * @param avatarUrl Path to the avatar image
	 * @param identityId Identity ID to modify. If empty, will use default identity
	 */
	void setIdentityAvatar(const QString &avatarUrl, const QString &identityId = QString());

	/**
	 * @brief Get the list of all the identities's ID
	 */
	QStringList identities() const;

	/**
	 * @brief Get a list of all account's ID
	 */
	QStringList accounts() const;

	/**
	 * @brief Connect all accounts
	 */
	void connectAll();

	/**
	 * @brief Disconnect all accounts
	 */
	void disconnectAll();

	/**
	 * @brief Change the online status for all accounts
	 *
	 * Accepted values for status are: Online, Busy, Away, Available 
	 * @param status The english word for the status you want.
	 * @param message Optional status message
	 */
	void setStatus(const QString &status, const QString &message = QString());

	/**
	 * @brief Change the status message for all accounts
	 *
 	 * Use an empty string to clear the status message
	 * @param message Status message
	 */
	void setStatusMessage(const QString &message);

	/**
	 * @brief Send a message to the given contact
	 * @param displayName Metacontact display name to send a messasge
	 * @param message The message to send
	 */
	void sendMessage(const QString &displayName, const QString &message);
	
	/**
	 * @brief Adds a contact with the specified params.
	 *
	 * @param protocolName The name of the protocol this contact is for ("Jabber", etc)
	 * @param accountId The account ID to add the contact to
	 * @param contactId The unique ID for this protocol
	 * @param displayName The displayName of the contact (may equal userId for some protocols
	 * @param groupName The name of the group to add the contact to
	 * @return Weather or not the contact was added successfully
	 */
	bool addContact( const QString &protocolName, const QString &accountId, const QString &contactId, const QString &displayName, const QString &groupName = QString() );

	/**
	 * @brief Send a file to the given contact
	 * @param displayName Metacontact display name to send a file
	 * @param fileUrl Url of the file to send
	 */
	void sendFile( const QString &displayName, const QString &fileUrl );

	/**
	 * @brief Connect a given account in the given protocol
	 * @param protocolName The protocol name (ex: Jabber, Yahoo, Messenger)
	 * @param accountId Account ID
	 */
	void connect(const QString &protocolName, const QString &accountId);

	/**
	 * @brief Disconnect a given account in the given protocol
	 * @param protocolName The protocol name (ex: Jabber, Yahoo, Messenger)
	 * @param accountId Account ID
	 */
	void disconnect(const QString &protocolName, const QString &accountId);
};

#endif
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
<node>
  <interface name="org.kde.Kopete">
    <method name="contacts">
      <arg type="as" direction="out"/>
    </method>
    <method name="contactsByFilter">
      <arg type="as" direction="out"/>
      <arg name="filter" type="s" direction="in"/>
    </method>
    <method name="setIdentityNickName">
      <arg name="nickName" type="s" direction="in"/>
      <arg name="identityId" type="s" direction="in"/>
    </method>
    <method name="setIdentityNickName">
      <arg name="nickName" type="s" direction="in"/>
    </method>
    <method name="setIdentityAvatar">
      <arg name="avatarUrl" type="s" direction="in"/>
      <arg name="identityId" type="s" direction="in"/>
    </method>
    <method name="setIdentityAvatar">
      <arg name="avatarUrl" type="s" direction="in"/>
    </method>
    <method name="identities">
      <arg type="as" direction="out"/>
    </method>
    <method name="accounts">
      <arg type="as" direction="out"/>
    </method>
    <method name="connectAll">
    </method>
    <method name="disconnectAll">
    </method>
    <method name="setStatus">
      <arg name="status" type="s" direction="in"/>
      <arg name="message" type="s" direction="in"/>
    </method>
    <method name="setStatus">
      <arg name="status" type="s" direction="in"/>
    </method>
    <method name="setStatusMessage">
      <arg name="message" type="s" direction="in"/>
    </method>
    <method name="sendMessage">
      <arg name="displayName" type="s" direction="in"/>
      <arg name="message" type="s" direction="in"/>
    </method>
    <method name="addContact">
      <arg type="b" direction="out"/>
      <arg name="protocolName" type="s" direction="in"/>
      <arg name="accountId" type="s" direction="in"/>
      <arg name="contactId" type="s" direction="in"/>
      <arg name="displayName" type="s" direction="in"/>
      <arg name="groupName" type="s" direction="in"/>
    </method>
    <method name="addContact">
      <arg type="b" direction="out"/>
      <arg name="protocolName" type="s" direction="in"/>
      <arg name="accountId" type="s" direction="in"/>
      <arg name="contactId" type="s" direction="in"/>
      <arg name="displayName" type="s" direction="in"/>
    </method>
    <method name="sendFile">
      <arg name="displayName" type="s" direction="in"/>
      <arg name="fileUrl" type="s" direction="in"/>
    </method>
    <method name="connect">
      <arg name="protocolName" type="s" direction="in"/>
      <arg name="accountId" type="s" direction="in"/>
    </method>
    <method name="disconnect">
      <arg name="protocolName" type="s" direction="in"/>
      <arg name="accountId" type="s" direction="in"/>
    </method>
  </interface>
</node>
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to