Examples of Buddy


Examples of net.solosky.maplefetion.bean.Buddy

      List list = XMLHelper.findAll(event, "/event/contacts/mobile-buddies/*mobile-buddy");
      Iterator it = list.iterator();
      while(it.hasNext()) {
        Element e = (Element) it.next();
        String uri = e.getAttributeValue("uri");
        Buddy buddy = context.getFetionStore().getBuddyByUri(uri);
        if(buddy!=null) {
          //检查用户关系的变化
          Relation relation = ParseHelper.parseRelation(e.getAttributeValue("relation-status"));
          //如果当前好友关系是没有确认,而返回的好友是确认了,表明好友同意了你添加好友的请求
          if(relation==Relation.BUDDY && buddy.getRelation()!=Relation.BUDDY) {
           
            //因为这里是手机好友,没有详细信息,故不再获取详细信息
            logger.debug("Mobile buddy agreed your buddy request:"+buddy.getFetionId());
            this.tryFireNotifyEvent(new BuddyConfirmedEvent(buddy, true));    //通知监听器
           
          }else if(relation==Relation.DECLINED) {  //对方拒绝了请求
           
            logger.debug("buddy declined your buddy request:"+buddy.getDisplayName());
            this.tryFireNotifyEvent(new BuddyConfirmedEvent(buddy, false))//通知监听器
           
          }else {}

            //buddy.setUserId(Integer.parseInt(e.getAttributeValue("user-id")));
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

      List list = XMLHelper.findAll(event, "/event/contacts/buddies/*buddy");
      Iterator it = list.iterator();
      while(it.hasNext()) {
        Element e =  (Element) it.next();
        String uri = e.getAttributeValue("uri");
        final Buddy buddy = context.getFetionStore().getBuddyByUri(uri);
        if(buddy!=null) {
          //检查用户关系的变化
          Relation relation = ParseHelper.parseRelation(e.getAttributeValue("relation-status"));
          //如果当前好友关系是没有确认,而返回的好友是确认了,表明好友同意了你添加好友的请求
          if(relation==Relation.BUDDY && buddy.getRelation()!=Relation.BUDDY) {
           
            //这里还需要获取好友的详细信息
            SipcRequest request = dialog.getMessageFactory().createGetContactInfoRequest(buddy.getUri());
            request.setResponseHandler(new GetContactInfoResponseHandler(context, dialog, ((Buddy) buddy),null));
          dialog.process(request);
         
          }else if(relation==Relation.DECLINED) {  //对方拒绝了请求
            logger.debug("buddy declined your buddy request:"+buddy.getDisplayName());
            this.tryFireNotifyEvent(new BuddyConfirmedEvent( buddy, false))//通知监听器
          }else {}

          //buddy.setUserId(Integer.parseInt(e.getAttributeValue("user-id")));
          buddy.setRelation(relation);
         
          context.getFetionStore().flushBuddy(buddy);
        }
      }
    }
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

      while(it.hasNext()){
        Element e = (Element) it.next();
        String suserId = e.getAttributeValue("user-id")//使用user-id更合理
        if(suserId!=null){
          int    iuserId = Integer.parseInt(suserId);
          Buddy buddy    = store.getBuddyByUserId(iuserId);
          if(buddy!=null){
            store.deleteBuddy(buddy);
            logger.info("Deleted buddy: "+buddy);
          }
        }
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

      while(it.hasNext()){
        Element e = (Element) it.next();
        String uri = e.getAttributeValue("uri");
        if(uri!=null){
          //这里应该都是飞信好友,不过还是做了相应的判断
          Buddy buddy = null;
        buddy = new Buddy();
        BeanHelper.toBean(Buddy.class, buddy, e);
         
          buddy.setRelation(Relation.BUDDY);
        store.addBuddy(buddy);
       
        logger.info("Added Buddy : "+buddy);
        }
      }
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

       * 显示一个组的用户
       */
      public int cord(int cordId, String name,int startId,Collection<Buddy> buddyList)
      {
        Iterator<Buddy> it = buddyList.iterator();
        Buddy buddy = null;
        println("\n-------------------------------");
        println("【"+cordId+"::"+name+"】");
        println("-------------------------------");
        if(buddyList.size()==0) {
          println("暂无好友。。");
        }
      while(it.hasNext()) {
        buddy = it.next();
        this.buddymap.put(Integer.toString(startId), buddy.getUri());
        String impresa = buddy.getImpresa();
        println(Integer.toString(startId)+" "+formatRelation(buddy.getRelation())+" "+fomartString(buddy.getDisplayName(),10)+"\t"
            +buddy.getDisplayPresence()
            +"\t"+(impresa==null?"":impresa));
        startId++;
      }
      return startId;
      }
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

       * 发送消息
       * @throws Exception
       */
      public void to(String uri,final String message)
      {
        final Buddy buddy = this.client.getFetionStore().getBuddyByUri(uri);
        if(buddy!=null) {
          this.send(buddy, message);
        }else {
          println("找不到这个好友,请检查你的输入!");
        }
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

      /**
       * 发送手机短信消息
       */
      public void sms(String uri, final String message)
      {
        final Buddy buddy = this.client.getFetionStore().getBuddyByUri(uri);
        if(buddy!=null) {
          this.client.sendSMSMessage(buddy, Message.wrap(message), new ActionEventListener(){
          public void fireEevent(ActionEvent event)
          {
            if(event.getEventType()==ActionEventType.SUCCESS){
              println("提示:发送给"+buddy.getDisplayName()+" 的短信发送成功!");
            }else{
              println("[系统消息]:你发给 "+buddy.getDisplayName()+" 的短信  "+message+" 发送失败!");
            }
          }
        });
        }else {
          println("找不到这个好友,请检查你的输入!");
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

      /**
       * 获取好友详细信息
       */
      public void detail(String uri)
      {
        final Buddy buddy = this.client.getFetionStore().getBuddyByUri(uri);
        if(buddy==null) {
          println("找不到好友,请重新输入好友信息");
        }else if(UriHelper.isMobile(buddy.getUri())) {
          printBuddyInfo(buddy);
        }else {
          this.client.retireBuddyInfo(buddy, new ActionEventListener() {
          public void fireEevent(ActionEvent event)
          {
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

       * @param uri
       * @param localName
       */
      public void localname(String uri, String localName)
      {
        final Buddy buddy = this.client.getFetionStore().getBuddyByUri(uri);
        if(buddy!=null) {
          this.client.setBuddyLocalName(buddy, localName, new ActionEventListener() {
             public void fireEevent(ActionEvent event)
           {
             if(event.getEventType()==ActionEventType.SUCCESS){
View Full Code Here

Examples of net.solosky.maplefetion.bean.Buddy

      /**
       * 设置好友分组
       */
      public void cord(String uri, String cordId)
      {
        final Buddy buddy = this.client.getFetionStore().getBuddyByUri(uri);
        Collection<Cord> cordList = new ArrayList<Cord>();
        //本来一个好友可以分到多个组的,为了简单这里只实现了修改一个分组
        int cid = -1;
            try {
              cid = Integer.parseInt(cordId);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.