Package net.solosky.maplefetion.bean

Examples of net.solosky.maplefetion.bean.Message


     
      //查找消息是哪个好友发送的
        FetionStore store = this.context.getFetionStore();
      Buddy from   = store.getBuddyByUri(notify.getFrom());
      String body  = notify.getBody()!=null?notify.getBody().toSendString():""//防止产生NULL错误
      Message msg  = this.parseMessage(notify);
     
      //如果好友没有找到,可能是陌生人发送的信息,
      if(from==null) {
        //这里新建一个好友对象,并设置关系为陌生人
        from = UriHelper.createBuddy(notify.getFrom());
View Full Code Here


     * @return
     */
    private Message parseMessage(SipcNotify notify)
    {
       String body  = notify.getBody()!=null?notify.getBody().toSendString():""//防止产生NULL错误
       Message msg  = null;
       SipcHeader contentHeader = notify.getHeader(SipcHeader.CONTENT_TYPE);
       if(contentHeader!=null) {
         String value = contentHeader.getValue();
         if(Message.TYPE_PLAIN.equals(value)){
           msg = new Message(body, Message.TYPE_PLAIN);
         }else if(Message.TYPE_HTML.equals(value)){
           msg = new Message(body, Message.TYPE_HTML);
         }else{
           msg = new Message(body, Message.TYPE_PLAIN);
         }
       }else {
         msg = new Message(body, Message.TYPE_PLAIN)//默认为普通文本
       }
      
       return msg;
    }
View Full Code Here

    public void sendSMS(String uri, final String msg)
    {
      try{
          Buddy buddy = this.client.getFetionStore().getBuddyByUri(uri);
          ChatDialogProxy dialog = this.client.getChatDialogProxyFactory().create(buddy);
        dialog.sendChatMessage(new Message(msg), new DefaultActionListener("发送消息[ "+msg+" ]给"+buddy.getDisplayName()));
        } catch (FetionException e) {
          println("建立对话框时出错"+e.getMessage());
        }
    }
View Full Code Here

      }
     
      public void tel(final String tel, String msg)
      {
        long mobile = Long.parseLong(tel);
        this.client.sendChatMessage(mobile, new Message(StringHelper.qouteHtmlSpecialChars(msg), Message.TYPE_PLAIN), new ActionEventListener() {
        public void fireEevent(ActionEvent event)
        {
          switch(event.getEventType()){
           
            case SUCCESS:
View Full Code Here

      /**
       * 给自己发送短信
       */
      public void self(String message)
      {
        this.client.sendSMSMessage(this.client.getFetionUser(), new Message(message, Message.TYPE_PLAIN), new ActionEventListener(){
              public void fireEevent(ActionEvent event)
        {
          if(event.getEventType()==ActionEventType.SUCCESS){
            println("给自己发送短信成功!");
          }else{
View Full Code Here

      LoginState state = client.syncLogin();
      if(state==LoginState.LOGIN_SUCCESS){  //登录成功
        System.out.println("登录成功,正在发送消息至 "+args[2]+",请稍候...");                     
         
        ActionEventFuture future = new ActionEventFuture()//建立一个Future来等待操作事件     
        client.sendChatMessage(Long.parseLong(args[2]), new Message(args[3]), future);
        ActionEvent event = future.waitActionEventWithoutException()//等待操作完成事件
        switch(event.getEventType()){
         
          case SUCCESS:
            SendChatMessageSuccessEvent evt = (SendChatMessageSuccessEvent) event;
View Full Code Here

          BeanHelper.setValue(sc, "sendDate", df.parse(e.getAttributeValue("send-time")))//发送时间
        } catch (ParseException e1) {
          throw new net.solosky.maplefetion.util.ParseException("Parse scheduleSMS send-time failed. "+e.getAttributeValue("sendTime"));
        }
       
        BeanHelper.setValue(sc, "message", new Message(e.getChild("message").getText()))//消息内容
       
        ArrayList<Buddy> recieverList = new ArrayList<Buddy>();
        List recvList = XMLHelper.findAll(e, "/schedule-sms/receivers/*receiver");    //接收者
        Iterator rit =recvList.iterator();
        while(rit.hasNext()){
View Full Code Here

TOP

Related Classes of net.solosky.maplefetion.bean.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.