当前位置: 首页>>代码示例>>Java>>正文


Java ChatMessageListener类代码示例

本文整理汇总了Java中org.jivesoftware.smack.chat.ChatMessageListener的典型用法代码示例。如果您正苦于以下问题:Java ChatMessageListener类的具体用法?Java ChatMessageListener怎么用?Java ChatMessageListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChatMessageListener类属于org.jivesoftware.smack.chat包,在下文中一共展示了ChatMessageListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fireNewChatState

import org.jivesoftware.smack.chat.ChatMessageListener; //导入依赖的package包/类
private void fireNewChatState(Chat chat, ChatState state) {
    for (ChatMessageListener listener : chat.getListeners()) {
        if (listener instanceof ChatStateListener) {
            ((ChatStateListener) listener).stateChanged(chat, state);
        }
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:8,代码来源:ChatStateManager.java

示例2: onPostExecute

import org.jivesoftware.smack.chat.ChatMessageListener; //导入依赖的package包/类
@Override
protected void onPostExecute(String result) {
    super.onPostExecute(result);

    if(result.equals("connected")){
        try {
            ConnectedMessage();

            pb_progressbar.setVisibility(View.GONE);
            ll_chat_window.setVisibility(View.VISIBLE);

            mChatmanager = mChatmanager.getInstanceFor(mConnection);
            friendJID = (EntityJid) JidCreate.from(friendID);
            mChat = mChatmanager.createChat(friendJID, new ChatMessageListener() {
                public void processMessage(org.jivesoftware.smack.chat.Chat chat, Message message) {

            // receiving the chat message from the support executive
                    if(!message.getBody().trim().equals("")){
                        mChatFunctionModel = new Chat();
                        mChatFunctionModel.setGotMessage(message.getBody());
                        mChatFunctionModel.setGotTime(new Date().getTime());
                        mChatFunctionModel.setSentMessage("");
                        chatsList.add(mChatFunctionModel);

                        runOnUiThread(new Runnable() {
                            public void run() {
                                mAdapter.notifyDataSetChanged();
                                mRecyclerView.smoothScrollToPosition(chatsList.size());
                                et_msgToBeSent.setFocusable(true);
                            }
                        });
                    }
                }
            });
        } catch (XmppStringprepException e) {
            e.printStackTrace();
        }
    }
    else{
        cannotConnectMessage();
    }

}
 
开发者ID:Asutosh11,项目名称:CustomerSupportChat,代码行数:44,代码来源:ChatActivity.java

示例3: createPrivateChat

import org.jivesoftware.smack.chat.ChatMessageListener; //导入依赖的package包/类
/**
 * Returns a new Chat for sending private messages to a given room occupant.
 * The Chat's occupant address is the room's JID (i.e. [email protected]/nick). The server
 * service will change the 'from' address to the sender's room JID and delivering the message
 * to the intended recipient's full JID.
 *
 * @param occupant occupant unique room JID (e.g. '[email protected]/Paul').
 * @param listener the listener is a message listener that will handle messages for the newly
 * created chat.
 * @return new Chat for sending private messages to a given room occupant.
 */
public Chat createPrivateChat(String occupant, ChatMessageListener listener) {
    return ChatManager.getInstanceFor(connection).createChat(occupant, listener);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:15,代码来源:MultiUserChat.java


注:本文中的org.jivesoftware.smack.chat.ChatMessageListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。