So we are now in time to develop a high-level channel API for tp-qt4, 
this API is meant to be simple but extensible, allowing custom channel 
types to be constructed

So here is a sketch of this high-level API:

class Channel:
{
public:
  string channelType();
  uint targetHandle();
  uint targetHandleType();

  // indicate whether this channel can be closed, contact list cannot be 
closed for example
  bool mayClose()
  bool isClosed()
  PendingOperation *requestClose()

  bool isReady()
  PendingReadyChannel *becomeReady()

  // interfaces(), optional interfaces, ...
  ...

signals:
  void closed();
}

class GroupChannel : Channel:
{
public:
  Contact[] currentMembers()
  Contact[] localPendingMembers()
  Contact[] remotePendingMembers()

  bool mayAddOthers();
  // invite, accept
  PendingOperation *addContact(Contact, string);
  bool mayRemoveOthers();
  // kick, reject
  PendingOperation *removeContact(Contact, string);

  ...

signals:
  void membersChanged(Contact[] current, Contact[] local, Contact[] remote);
}

class TextChannel : GroupChannel
{
public:
  UintList allowedMessageTypes();

  PendingOperation *acknowledgePendingMessages(UintList messagesIds)
  PendingMessages *pendingMessages();
  PendingMessageToken *sendMessage(uint type, string message)
 
signals:
  void messageReceived(...)
  void messageSent(...)
  void messageSendError(...)
}

class ContactListChannel : GroupChannel
{
}

class PendingChannel:
public:
  string objectPath()

  Connection *connection()

  uint channelType()
  uint targetHandleType()
  uint targetHandle()

  // using this method will instantiate a specialized channel type based 
on well know channel types,
  // this method should not be used for custom type channels
  Channel *channel()

  ...
}

The basic idea is to have a basic Channel class that will implement 
high-level API for Channel interface,
a GroupChannel class that will implement the Group interface and 
specialized channels for Text, StreamedMedia, etc...

Requesting or receiving NewChannel signals should give the user a 
PendingChannel that can be used to create the channel.

Custom channels:
When Requesting or receiving a NewChannel signal a PendingChannel will 
be given, and this one can be used to create custom Channel types
by using its objectPath method.

Ideas, suggestions?

BR
Andre
_______________________________________________
Telepathy mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/telepathy

Reply via email to