chatManager = connection.getChatManager(); messageListener = new MyMessageListener(); chatManagerListener = new ChatManagerListener() { @Override public void chatCreated(Chat chat, boolean createdLocally) { chat.addMessageListener(messageListener); } }; chatManager.addChatListener(chatManagerListener);
// Assume we've created a Connection name "connection". ChatManager chatmanager = connection.getChatManager().addChatListener( new ChatManagerListener() { @Override public void chatCreated(Chat chat, boolean createdLocally) { if (!createdLocally) chat.addMessageListener(new MyNewMessageListener());; } });
public void chatCreated(Chat chat, boolean createdLocally) { if (!createdLocally) { chat.addMessageListener(new ChatMessageListener()...); } }
public void chatCreated(final Chat chat, boolean createdLocally) { chat.addMessageListener(this); }
public void chatCreated(final Chat chat, boolean createdLocally) { chat.addMessageListener(this); }
public void chatCreated(final Chat chat, boolean createdLocally) { chat.addMessageListener(this); }
@Override public void chatCreated(Chat chat, boolean createdLocally) { chat.addMessageListener(new MsgListener(IotXmppService.this, mNotificationManager)); } });
/** * Creates a new chat using the specified thread ID, then returns it. * * @param userJID the jid of the user this chat is with * @param thread the thread of the created chat. * @param listener the listener to add to the chat * @return the created chat. */ public Chat createChat(String userJID, String thread, MessageListener listener) { if(thread == null) { thread = nextID(); } Chat chat = threadChats.get(thread); if(chat != null) { throw new IllegalArgumentException("ThreadID is already used"); } chat = createChat(userJID, thread, true); chat.addMessageListener(listener); return chat; }
/** * Creates a new chat using the specified thread ID, then returns it. * * @param userJID the jid of the user this chat is with * @param thread the thread of the created chat. * @param listener the listener to add to the chat * @return the created chat. */ public Chat createChat(String userJID, String thread, MessageListener listener) { if(thread == null) { thread = nextID(); } Chat chat = threadChats.get(thread); if(chat != null) { throw new IllegalArgumentException("ThreadID is already used"); } chat = createChat(userJID, thread, true); chat.addMessageListener(listener); return chat; }
/** * Creates a new chat using the specified thread ID, then returns it. * * @param userJID the jid of the user this chat is with * @param thread the thread of the created chat. * @param listener the listener to add to the chat * @return the created chat. */ public Chat createChat(String userJID, String thread, MessageListener listener) { if(thread == null) { thread = nextID(); } Chat chat = threadChats.get(thread); if(chat != null) { throw new IllegalArgumentException("ThreadID is already used"); } chat = createChat(userJID, thread, true); chat.addMessageListener(listener); return chat; }
@Override public void chatCreated(Chat c, boolean locally) { final Friend friend = getFriendById(c.getParticipant()); if (friend != null) { c.addMessageListener(new MessageListener() { @Override public void processMessage(Chat chat, Message msg) { for (final ChatListener c : chatListeners) { if (msg.getType() == Message.Type.chat) { c.onMessage(friend, msg.getBody()); } } } }); } } });
AppLogs.logInfo(TAG, "chat value single chat 1 :" + chat); } else { chat.addMessageListener(messageListener); AppLogs.logInfo(TAG, "chat value single chat 2:" + chat);