Exemplo n.º 1
0
 public void showMessage(ControllerEvent event, int type) throws Exception {
   // 判断msgFrame是否visible
   MessageFrame msgFrame = getMessageFrame();
   if (msgFrame.isVisible()) {
     Vovo.exeC(event.getExClass(), event.getExMethod(), event.getParas());
   } else {
     String lccno = (String) event.getParas()[0];
     String key = null;
     if (Constants.MSG_TYPE_FRIEND == type) {
       key = Constants.FRIEND_CHAT_SESSION_PREFIX + lccno;
     } else if (Constants.MSG_TYPE_GROUP == type) {
       key = Constants.GROUP_CHAT_SESSION_PREFIX + lccno;
     }
     List<Object[]> notReadMsg = DataUtil.getNotReadMsg(key);
     Object[] temp = event.getParas();
     if (notReadMsg == null) { // 没有未读信息
       MyTrayIcon trayIcon =
           context.getViewManager().getView(Constants.ViewKey.TRAYICON.toString());
       event.setImage(ImageUtil.getImage(ImageUtil.TRAY_ICON_REC_MSG));
       event.setExClass("chat");
       event.setExMethod("showNotReadMessage");
       event.setParas(new Object[] {key});
       trayIcon.addEvent(event);
     }
     DataUtil.addNotReadMsg(key, temp);
   }
 }
Exemplo n.º 2
0
 public void transferInterrupt(String lccno, String streamID, String fileName) throws Exception {
   MemberBean memberBean = TreeUtil.getMemberBeanByLccno(lccno);
   final FriendChatPanel panel = getFriendChatPanel(memberBean);
   String info = StringUtil.getFormatString(getUIString("sendFile.interrupt"), fileName);
   long systemTime = Vovo.getLcmUtil().getSystemTime();
   panel.otherCancelSendFile(streamID, new Date(systemTime), info);
   DataUtil.removeFileTransfer(streamID);
 }
Exemplo n.º 3
0
 public void showNotReadMessage(String key) {
   List<Object[]> notReadMsg = DataUtil.getNotReadMsg(key);
   if (notReadMsg == null) {
     return;
   }
   for (Object[] paras : notReadMsg) {
     if (key.startsWith(Constants.FRIEND_CHAT_SESSION_PREFIX)) {
       Vovo.exeC("chat", "getFriendMessage", paras);
       try {
         RecentContactManager.getInstance().insertFriendChat((String) paras[0]);
       } catch (IOException e) {
       }
     } else if (key.startsWith(Constants.GROUP_CHAT_SESSION_PREFIX)) {
       Vovo.exeC("groupChat", "getGroupChatMessage", paras);
       try {
         RecentContactManager.getInstance().insertGroupChat((String) paras[0]);
       } catch (IOException e) {
       }
     }
   }
   DataUtil.removeNotReadMsg(key);
 }
Exemplo n.º 4
0
 public void getOtherMsg(String lccno, String operate, Message msg) throws Exception {
   if (Constants.OTHERMSG_OPERATE_CANCELSENDFILE.equals(operate)) {
     String streamID = (String) msg.getProperty("streamID");
     Date sendDate = new Date((Long) msg.getProperty("sendDate"));
     FileTransferRequest req = DataUtil.getFileTransferRequest(streamID);
     MessageFrame msgFrame = getMessageFrame();
     MemberBean memberBean = TreeUtil.getMemberBeanByLccno(lccno);
     final FriendChatPanel panel = getFriendChatPanel(memberBean);
     String info =
         StringUtil.getFormatString(
             getUIString("sendFile.otherCancel"), "\"" + req.getFileName() + "\"");
     panel.otherCancelSendFile(streamID, sendDate, info);
     msgFrame.setVisible(true);
   }
 }
Exemplo n.º 5
0
 public void sendFriendMsg(
     String msg,
     FontStyle fontStyle,
     String lccno,
     int memberId,
     Map<String, String> imgs,
     long time)
     throws Exception {
   MyOpenfireUtil.sendFriendMsg(lccno, msg, fontStyle, imgs, time);
   VovoMyInfo info = DataUtil.getMyInfo();
   ChatRecord c =
       new ChatRecord(
           info.getId(),
           info.getRealName(),
           msg,
           new Date(time),
           fontStyle,
           Constants.FRIEND_CHAT_SESSION_PREFIX + memberId);
   Vovo.exeS("dataStore", "saveChatRecord", c);
 }
Exemplo n.º 6
0
 public void sendFileComplete(String lccno, String streamID, String fileName) throws Exception {
   MemberBean memberBean = TreeUtil.getMemberBeanByLccno(lccno);
   final FriendChatPanel panel = getFriendChatPanel(memberBean);
   panel.sendFileComplete(streamID, fileName);
   DataUtil.removeFileTransfer(streamID);
 }