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


Java EMMessage.getJSONArrayAttribute方法代码示例

本文整理汇总了Java中com.hyphenate.chat.EMMessage.getJSONArrayAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java EMMessage.getJSONArrayAttribute方法的具体用法?Java EMMessage.getJSONArrayAttribute怎么用?Java EMMessage.getJSONArrayAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hyphenate.chat.EMMessage的用法示例。


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

示例1: isAtMeMsg

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
public boolean isAtMeMsg(EMMessage message){
    EaseUser user = EaseUserUtils.getUserInfo(message.getFrom());
    if(user != null){
        try {
            JSONArray jsonArray = message.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
            
            for(int i = 0; i < jsonArray.length(); i++){
                String username = jsonArray.getString(i);
                if(username.equals(EMClient.getInstance().getCurrentUser())){
                    return true;
                }
            }
        } catch (Exception e) {
            //perhaps is a @ all message
            String atUsername = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
            if(atUsername != null){
                if(atUsername.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
                    return true;
                }
            }
            return  false;
        }
        
    }
    return false;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:27,代码来源:EaseAtMessageHelper.java

示例2: isAtMeMsg

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
public boolean isAtMeMsg(EMMessage message){
    EaseUser user = EaseUserUtils.getUserInfo(message.getFrom());
    if(user != null){
        try {
            JSONArray jsonArray = message.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);

            for(int i = 0; i < jsonArray.length(); i++){
                String username = jsonArray.getString(i);
                if(username.equals(EMClient.getInstance().getCurrentUser())){
                    return true;
                }
            }
        } catch (Exception e) {
            //perhaps is a @ all message
            String atUsername = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
            if(atUsername != null){
                if(atUsername.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
                    return true;
                }
            }
            return  false;
        }

    }
    return false;
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:27,代码来源:EaseAtMessageHelper.java

示例3: isAtMeMsg

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
public boolean isAtMeMsg(EMMessage message) {
    EaseUser user = EaseUserUtils.getUserInfo(message.getFrom());
    if (user != null) {
        try {
            JSONArray jsonArray = message.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);

            for (int i = 0; i < jsonArray.length(); i++) {
                String username = jsonArray.getString(i);
                if (username.equals(EMClient.getInstance().getCurrentUser())) {
                    return true;
                }
            }
        } catch (Exception e) {
            //perhaps is a @ all message
            String atUsername = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
            if (atUsername != null) {
                if (atUsername.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)) {
                    return true;
                }
            }
            return false;
        }

    }
    return false;
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:27,代码来源:EaseAtMessageHelper.java

示例4: parseMessages

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * parse the message, get and save group id if I was mentioned(@)
 * @param messages
 */
public void parseMessages(List<EMMessage> messages) {
    int size = atMeGroupList.size();
    EMMessage[] msgs = messages.toArray(new EMMessage[messages.size()]);
    for(EMMessage msg : msgs){
        if(msg.getChatType() == ChatType.GroupChat){
            String groupId = msg.getTo();
            try {
                JSONArray jsonArray = msg.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
                for(int i = 0; i < jsonArray.length(); i++){
                    String username = jsonArray.getString(i);
                    if(EMClient.getInstance().getCurrentUser().equals(username)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                            break;
                        }
                    }
                }
            } catch (Exception e1) {
                //Determine whether is @ all message
                String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
                if(usernameStr != null){
                    if(usernameStr.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                        }
                    }
                }
            }
            
            if(atMeGroupList.size() != size){
                EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
            }
        }
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:40,代码来源:EaseAtMessageHelper.java

示例5: parseMessages

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * parse the message, get and save group id if I was mentioned(@)
 * @param messages
 */
public void parseMessages(List<EMMessage> messages) {
    int size = atMeGroupList.size();
    EMMessage[] msgs = messages.toArray(new EMMessage[messages.size()]);
    for(EMMessage msg : msgs){
        if(msg.getChatType() == EMMessage.ChatType.GroupChat){
            String groupId = msg.getTo();
            try {
                JSONArray jsonArray = msg.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
                for(int i = 0; i < jsonArray.length(); i++){
                    String username = jsonArray.getString(i);
                    if(EMClient.getInstance().getCurrentUser().equals(username)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                            break;
                        }
                    }
                }
            } catch (Exception e1) {
                //Determine whether is @ all message
                String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
                if(usernameStr != null){
                    if(usernameStr.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
                        if(!atMeGroupList.contains(groupId)){
                            atMeGroupList.add(groupId);
                        }
                    }
                }
            }

            if(atMeGroupList.size() != size){
                EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
            }
        }
    }
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:40,代码来源:EaseAtMessageHelper.java

示例6: parseMessages

import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
 * parse the message, get and save group id if I was mentioned(@)
 *
 * @param messages
 */
public void parseMessages(List<EMMessage> messages) {
    int size = atMeGroupList.size();
    EMMessage[] msgs = messages.toArray(new EMMessage[messages.size()]);
    for (EMMessage msg : msgs) {
        if (msg.getChatType() == ChatType.GroupChat) {
            String groupId = msg.getTo();
            try {
                JSONArray jsonArray = msg.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
                for (int i = 0; i < jsonArray.length(); i++) {
                    String username = jsonArray.getString(i);
                    if (EMClient.getInstance().getCurrentUser().equals(username)) {
                        if (!atMeGroupList.contains(groupId)) {
                            atMeGroupList.add(groupId);
                            break;
                        }
                    }
                }
            } catch (Exception e1) {
                //Determine whether is @ all message
                String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
                if (usernameStr != null) {
                    if (usernameStr.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)) {
                        if (!atMeGroupList.contains(groupId)) {
                            atMeGroupList.add(groupId);
                        }
                    }
                }
            }

            if (atMeGroupList.size() != size) {
               EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
            }
        }
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:41,代码来源:EaseAtMessageHelper.java


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