Package net.solosky.maplefetion.store

Examples of net.solosky.maplefetion.store.FetionStore


      SipcReceipt receipt = this.dialog.getMessageFactory()
      .createDefaultReceipt(notify.getFrom(), Integer.toString(notify.getCallID()), notify.getSequence());
      this.dialog.process(receipt);
     
      //查找消息是哪个好友发送的
        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) {
View Full Code Here


   * 获取群列表
   */
  public void getGroupList(ActionEventListener listener)
  {
    this.ensureOpened();
    FetionStore store = this.context.getFetionStore();
    SipcRequest request = this.getMessageFactory().createGetGroupListRequest(store.getStoreVersion().getGroupVersion());
    request.setResponseHandler(new GetGroupListResponseHandler(context, this, listener));
    this.process(request);
  }
View Full Code Here

        future.clear();
        dialog.getGroupList(listener);
        Dialog.assertActionEvent(future.waitActionEventWithException(), ActionEventType.SUCCESS);
       
    //如果群列表为空,就不发送下面的一些请求了
    FetionStore store = this.context.getFetionStore();
    if(store.getGroupList().size()==0){
      logger.debug("The group list is empty, group dialog login is skipped.");
      return;
    }

        //如果当前存储版本和服务器相同,就不获取群信息和群成员列表,
View Full Code Here

              user.setUserId(Integer.parseInt(userEl.getAttributeValue("user-id")));
              String mobileStr = userEl.getAttributeValue("mobile-no");
              if(mobileStr!=null && mobileStr.length()>0)
                user.setMobile(Long.parseLong(mobileStr));
             
              FetionStore store = this.fetionContext.getFetionStore();
              List list = XMLHelper.findAll(root, "/results/user/credentials/*credential");
              Iterator it = list.iterator();
              while(it.hasNext()) {
                Element c = (Element) it.next();
                store.addCredential(new Credential(c.getAttributeValue("domain"), c.getAttributeValue("c")));
              }
             
              logger.debug("SSISignV4:ssic="+user.getSsiCredential());
             
              break;
View Full Code Here

     */
    private void getGroupMembers(Element event) throws FetionException
    {
      List groupList = XMLHelper.findAll(event, "/event/results/groups/*group");
    Iterator it = groupList.iterator();
    FetionStore store = this.context.getFetionStore();
    while(it.hasNext()) {
      Element g = (Element) it.next();
      Group group = store.getGroup(g.getAttributeValue("uri"));
      //群下面的成员迭代
      List memberList = XMLHelper.findAll(g, "/group/*member");
      Iterator mit = memberList.iterator();
      while(mit.hasNext()) {
        Element e = (Element) mit.next();
        Member member = new Member();
       
        member.setUri(e.getAttributeValue("uri"));
        member.setNickName(e.getAttributeValue("nickname"));
        member.setIicNickName(e.getAttributeValue("iicnickname"));
        //member.setUserId(Integer.parseInt(e.getAttributeValue("user-id")));
        member.setT6svcid(Integer.parseInt(e.getAttributeValue("t6svcid")));
        member.setIdentity(Integer.parseInt(e.getAttributeValue("identity")));
       
        store.addGroupMember(group, member);
      }
    }
     
     
    }
View Full Code Here

     
    }
    this.dialog.process(receipt);
   
    //检查是否发起会话的好友是否存在,如果不存在建立一个新飞信好友对象,并设置关系为陌生人关系
    FetionStore store = this.context.getFetionStore();
    Buddy buddy = null;
    synchronized(store){
      buddy = store.getBuddyByUri(notify.getFrom());
      if(buddy==null){
        buddy = new Buddy();
        buddy.setUri(notify.getFrom());
        store.addBuddy(buddy);
      }
    }
   
    //检查之前的会话中,是否有BasicChatDialog 如果有,关闭
    ChatDialog basicDialog = context.getDialogFactory().findChatDialog(buddy);
View Full Code Here

      Element contacts = XMLHelper.find(event, "/event/contacts");
      List buddyList = XMLHelper.findAll(event, "/event/contacts/buddies/*buddy");
     
      //查找把这些好友,如果在当前列表中,直接从当前飞信好友列表中删除
      Iterator it = buddyList.iterator();
    FetionStore store = this.context.getFetionStore();
      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);
          }
        }
      }
     
      //更新联系人版本信息
      String sContactVersion = contacts.getAttributeValue("version");
      if(sContactVersion!=null){
        int iContactVersion = Integer.parseInt(sContactVersion);
        store.getStoreVersion().setContactVersion(iContactVersion);
      }
    }
View Full Code Here

      Element contacts = XMLHelper.find(event, "/event/contacts");
      List buddyList = XMLHelper.findAll(event, "/event/contacts/buddies/*buddy");
     
      //遍历所有需要添加的好友,逐个把好友添加到列表中
      Iterator it = buddyList.iterator();
    FetionStore store = this.context.getFetionStore();
      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);
        }
      }
     
      //更新联系人版本信息
      String sContactVersion = contacts.getAttributeValue("version");
      if(sContactVersion!=null){
        int iContactVersion = Integer.parseInt(sContactVersion);
        store.getStoreVersion().setContactVersion(iContactVersion);
      }
    }
View Full Code Here

      {
        println("\n=================================");
        println("所有好友列表");
        println("-------------------------------");
        println("#ID\t好友昵称\t在线状态\t个性签名");
        FetionStore store = this.client.getFetionStore();
        Iterator<Cord> it = store.getCordList().iterator();
        int id=0;
        this.buddymap.clear();
        //分组显示好友
        while(it.hasNext()) {
          Cord cord = it.next();
          id = cord(cord.getId(),cord.getTitle(),id, store.getBuddyListByCord(cord));
        }
        id = cord(-1,"默认分组", id, store.getBuddyListWithoutCord());
      }
View Full Code Here

    @Override
    protected ActionEvent doActionOK(SipcResponse response)
            throws FetionException
    {
      Element root = XMLHelper.build(response.getBody().toSendString());
      FetionStore store = this.context.getFetionStore();
      synchronized (store) {
       
          List list = XMLHelper.findAll(root, "/results/contacts/blacklist/*blocked");
          Iterator it = list.iterator();
         
        while(it.hasNext()) {
            Element e = (Element) it.next();
            String uri = e.getAttributeValue("uri");
            Buddy buddy = store.getBuddyByUri(uri);
            if(buddy!=null) {
              BeanHelper.setValue(buddy, "relation", Relation.BUDDY)//之前是什么状态呢。。。 TODO ..先暂时设置为好友关系
              context.getFetionStore().flushBuddy(buddy);
            }
          }
       
        Element el =  XMLHelper.find(root, "/results/contacts");
        String version = el.getAttributeValue("version");
        if(version!=null) {
          store.getStoreVersion().setContactVersion(Integer.parseInt(version));
        }
        }
     
      return super.doActionOK(response);
    }
View Full Code Here

TOP

Related Classes of net.solosky.maplefetion.store.FetionStore

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.