Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Retrieving nickname from ID

Hi Tim,

They could be seen as seperate APIs, but they are related closely enough in functionality to justify being one API. 

And...perhaps they will split out into two separate plugins/APIs at some point in the future.

Scott

ks Scott, that was indeed fast response.

I'm wondering though, does chat really belong to presense? Aren't they
two different feature sets? They can be used together, but I can see use
cases where presence makes perfect sense, but that has nothing to do
with chat.

Tim


On Sat, Apr 29, 2006 at 02:57:22PM -0700, Scott Lewis wrote:
  
Hi Tim,

Good idea.  I've added a new interface to the org.eclipse.ecf.presence API:

org.eclipse.ecf.presence.IChatID

public interface IChatID {
   /**
    * Get username for this ID
    * @return String username for ID
    */
   public String getUsername();
}

And I've implemented (for XMPPID, XMPPRoomID, and IRCID) this interface 
as an adapter off of ID...so the following will now work:

IChatID chatID = (IChatID) id.getAdapter(IChatID.class);
if (chatID != null) {
  String username = chatID.getUsername();
  ...use username here
}

This is checked in the source tree now (Sat 2:30pm pacific time).  And 
by the time you get this email the javadocs on the website will likely 
be updated with the IChatID class.

Thanks for suggestion Tim.

Scott


Tim Terlegård wrote:
    
Hi,

In my chat app I add a message listener using this code:

chatroom.addMessageListener(new IMessageListener() {
   public void handleMessage(final ID from, final ID to,
                             final IMessageListener.Type type,
			      final String subject, final String msg) {
       XMPPID id = (XMPPID) from;
	chatUI.handleMessage(from.getUsername(), msg);
  }
});

I have to cast the ID to XMPPID to be able to use getUsername(). That
restricts my code to xmpp. What about introducing ChatID? It could be an
interface that XMPPID and IRCID implements.

Tim
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
 
      
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
    
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
  


Back to the top