Exemplo n.º 1
0
  void FlexibleOffline::handleIqID( const IQ& iq, int context )
  {
    if( !m_flexibleOfflineHandler )
      return;

    switch( context )
    {
      case FORequestMsgs:
        switch( iq.subtype() )
        {
          case IQ::Result:
            m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrRequestSuccess );
            break;
          case IQ::Error:
            switch( iq.error()->error() )
            {
              case StanzaErrorForbidden:
                m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrForbidden );
                break;
              case StanzaErrorItemNotFound:
                m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrItemNotFound );
                break;
              default:
                m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrUnknownError );
                break;
            }
            break;
          default:
            break;
        }
        break;
      case FORemoveMsgs:
        switch( iq.subtype() )
        {
          case IQ::Result:
            m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrRemoveSuccess );
            break;
          case IQ::Error:
            switch( iq.error()->error() )
            {
              case StanzaErrorForbidden:
                m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrForbidden );
                break;
              case StanzaErrorItemNotFound:
                m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrItemNotFound );
                break;
              default:
                m_flexibleOfflineHandler->handleFlexibleOfflineResult( FomrUnknownError );
                break;
            }
            break;
          default:
            break;
        }
        break;
    }
  }
Exemplo n.º 2
0
  void LastActivity::handleIqID( const IQ& iq, int /*context*/ )
  {
    if( !m_lastActivityHandler )
      return;

    if( iq.subtype() == IQ::Result )
    {
      const Query* q = iq.findExtension<Query>( ExtLastActivity );
      if( !q || q->seconds() < 0 )
        return;

      m_lastActivityHandler->handleLastActivityResult( iq.from(), q->seconds(), q->status() );
    }
    else if( iq.subtype() == IQ::Error && iq.error() )
      m_lastActivityHandler->handleLastActivityError( iq.from(), iq.error()->error() );
  }
Exemplo n.º 3
0
  void Adhoc::handleIqID( const IQ& iq, int context )
  {
    if( context != ExecuteAdhocCommand )
      return;

    m_adhocTrackMapMutex.lock();
    AdhocTrackMap::iterator it = m_adhocTrackMap.find( iq.id() );
    bool haveIdHandler = ( it != m_adhocTrackMap.end() );
    m_adhocTrackMapMutex.unlock();
    if( !haveIdHandler || (*it).second.context != context
        || (*it).second.remote != iq.from() )
      return;

    switch( iq.subtype() )
    {
      case IQ::Error:
        (*it).second.ah->handleAdhocError( iq.from(), iq.error(), (*it).second.handlerContext );
        break;
      case IQ::Result:
      {
        const Adhoc::Command* ac = iq.findExtension<Adhoc::Command>( ExtAdhocCommand );
        if( ac )
          (*it).second.ah->handleAdhocExecutionResult( iq.from(), *ac, (*it).second.handlerContext );
        break;
      }
      default:
        break;
    }
    m_adhocTrackMapMutex.lock();
    m_adhocTrackMap.erase( it );
    m_adhocTrackMapMutex.unlock();
  }
Exemplo n.º 4
0
  void Client::processResourceBind( const IQ& iq )
  {
    switch( iq.subtype() )
    {
      case IQ::Result:
      {
        const ResourceBind* rb = iq.findExtension<ResourceBind>( ExtResourceBind );
        if( !rb || !rb->jid() )
        {
          notifyOnResourceBindError( 0 );
          break;
        }

        m_jid = rb->jid();
        m_resourceBound = true;
        m_selectedResource = m_jid.resource();
        notifyOnResourceBind( m_jid.resource() );

        if( m_streamFeatures & StreamFeatureSession )
          createSession();
        else
          connected();
        break;
      }
      case IQ::Error:
      {
        notifyOnResourceBindError( iq.error() );
        break;
      }
      default:
        break;
    }
  }
	void GroupsAdminManageMemberHandler::handleIqID( const IQ& iq, int context )
	{
		json::jobject jobj;
		if (iq.m_subtype != gloox::IQ::Result)
		{
			const Error* e = iq.error();
			if (!e)
			{
				callback_(true,XL("biz.GroupsAdminManageMember.fail"));
				return;
			}
			if ( e->error() == StanzaErrorBadRequest)
			{
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,请求协议错误!。"));
				callback_(true,XL("biz.crwod.iq_error.bad-request"));
			}
			else if (e->error() == StanzaErrorInternalServerError)
			{
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,处理错误(服务器处理错误)。"));
				callback_(true,XL("biz.crwod.iq_error.internal-server-error"));
			}
			else if (e->error() == StanzaErrorGone)
			{
				universal_resource err;
				err.res_key="biz.crwod.iq_error.answer_apply_gone";
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,消息已过期!"));
				callback_(false,err);
			}
			else if (e->error() == StanzaErrorForbidden)
			{
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,自己不是管理员"));
				callback_(true,XL("biz.crwod.iq_error.admin_forbidden"));
			}			
			else if (e->error() == StanzaErrorResourceConstraint)
			{
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,群成员已经满"));
				callback_(true,XL("biz.crwod.iq_error.admin_resource-constraint"));
			}
			else if (e->error() == StanzaErrorConflict)
			{
				universal_resource err;
				err.res_key="biz.crwod.iq_error.admin_Conflict";
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,该成员已加入群"));
				callback_(false,err);
			}
			else if (e->error() == StanzaErrorItemNotFound)
			{
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,找不到此群。"));
				callback_(true,XL("biz.crwod.iq_error.item-not-found"));
			}else
			{
				ELOG("app")->error(WCOOL(L"管理员审批成员加入时,服务器返回未知错误类型!") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml());
				callback_(true,XL("biz.GroupsAdminManageMember.fail"));
			}

		}else{
			callback_(false,XL(""));		
		}
	}
Exemplo n.º 6
0
  void NonSaslAuth::handleIqID( const IQ& iq, int context )
  {
    switch( iq.subtype() )
    {
      case IQ::Error:
      {
        const Error* e = iq.error();
        if( e )
        {
          switch( e->error() )
          {
            case StanzaErrorConflict:
              m_parent->setAuthFailure( NonSaslConflict );
              break;
            case StanzaErrorNotAcceptable:
              m_parent->setAuthFailure( NonSaslNotAcceptable );
              break;
            case StanzaErrorNotAuthorized:
              m_parent->setAuthFailure( NonSaslNotAuthorized );
              break;
            default:
              break;
          }
        }
        m_parent->setAuthed( false );
        m_parent->disconnect( ConnAuthenticationFailed );
        break;
      }
      case IQ::Result:
        switch( context )
        {
          case TrackRequestAuthFields:
          {
            const Query* q = iq.findExtension<Query>( ExtNonSaslAuth );
            if( !q )
              return;

            const std::string& id = m_parent->getID();

            IQ re( IQ::Set, JID(), id );
            re.addExtension( q->newInstance( m_parent->username(), m_sid,
                                             m_parent->password(),
                                             m_parent->jid().resource() ) );
            m_parent->send( re, this, TrackSendAuth );
            break;
          }
          case TrackSendAuth:
            m_parent->setAuthed( true );
            m_parent->connected();
            break;
        }
        break;

      default:
        break;
    }
  }
Exemplo n.º 7
0
void Search::handleIqID( const IQ& iq, int context )
{
    TrackMap::iterator it = m_track.find( iq.id() );
    if( it != m_track.end() )
    {
        switch( iq.subtype() )
        {
        case IQ::Result:
        {
            const Query* q = iq.findExtension<Query>( ExtSearch );
            if( !q )
                return;

            switch( context )
            {
            case FetchSearchFields:
            {
                if( q->form() )
                {
                    (*it).second->handleSearchFields( iq.from(), q->form() );
                }
                else
                {
                    (*it).second->handleSearchFields( iq.from(), q->fields(), q->instructions() );
                }
                break;
            }
            case DoSearch:
            {
                if( q->form() )
                {
                    (*it).second->handleSearchResult( iq.from(), q->form() );
                }
                else
                {
                    (*it).second->handleSearchResult( iq.from(), q->result() );
                }
                break;
            }
            }
            break;
        }
        case IQ::Error:
            (*it).second->handleSearchError( iq.from(), iq.error() );
            break;

        default:
            break;
        }

        m_track.erase( it );
    }

    return;
}
Exemplo n.º 8
0
  void VCardManager::handleIqID( const IQ& iq, int context )
  {
    TrackMap::iterator it = m_trackMap.find( iq.id() );
    if( it != m_trackMap.end() )
    {
      switch( iq.subtype() )
      {
        case IQ::Result:
        {
          switch( context )
          {
            case VCardHandler::FetchVCard:
            {
              const VCard* v = iq.findExtension<VCard>( ExtVCard );
              (*it).second->handleVCard( iq.from(), v );
              break;
            }
            case VCardHandler::StoreVCard:
              (*it).second->handleVCardResult( VCardHandler::StoreVCard, iq.from() );
              break;
          }
        }
        break;
        case IQ::Error:
        {
          (*it).second->handleVCardResult( (VCardHandler::VCardContext)context,
                                           iq.from(),
                                           iq.error() ? iq.error()->error()
                                                       : StanzaErrorUndefined );
          break;
        }
        default:
          break;
      }

      m_trackMap.erase( it );
    }
  }
Exemplo n.º 9
0
 void Client::processCreateSession( const IQ& iq )
 {
   switch( iq.subtype() )
   {
     case IQ::Result:
       connected();
       break;
     case IQ::Error:
       notifyOnSessionCreateError( iq.error() );
       break;
     default:
       break;
   }
 }
Exemplo n.º 10
0
	/*
	 <iq type=’result’from=’[email protected]’ to=’[email protected]’>
	 <queryxmlns=’groups:share:file:delete’>
	 <item id=‘2’ />
	 </query>
	 </iq>
	*/
	void InviteIntoGroupsHandler::handleIqID( const IQ& iq, int context )
	{
		json::jobject jobj;
		if (iq.m_subtype != gloox::IQ::Result)
		{
			const Error* e = iq.error();
			if (!e)
			{
				ELOG("app")->error(WCOOL(L"邀请加入群时,服务器返回未知错误类型!") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml());
				callback_(true,XL("biz.InviteIntoGroups.fail"));
				return;
			}

			if ( e->error() == StanzaErrorBadRequest)
			{
				ELOG("app")->error(WCOOL(L"邀请加入群时,请求协议错误!。"));
				callback_(true,XL("biz.crwod.iq_error.bad-request"));
			}
			else if (e->error() == StanzaErrorInternalServerError)
			{
				ELOG("app")->error(WCOOL(L"邀请加入群时,处理错误(服务器处理错误)。"));
				callback_(true,XL("biz.crwod.iq_error.internal-server-error"));
			}
			else if (e->error() == StanzaErrorConflict)
			{
				ELOG("app")->error(WCOOL(L"邀请加入群时,被邀请人已经在群里。"));
				callback_(true,XL("biz.crwod.iq_error.invite_conflict"));
			}
			else if (e->error() == StanzaErrorResourceConstraint)
			{
				ELOG("app")->error(WCOOL(L"邀请加入群时,群已经满员。"));
				callback_(true,XL("biz.crwod.iq_error.invite_resource-constraint"));
			}
			else if (e->error() == StanzaErrorNotAllowed)
			{
				ELOG("app")->error(WCOOL(L"邀请加入群时,邀请人不是管理员。"));
				callback_(true,XL("biz.crwod.iq_error.invite_not-allowed"));
			}else
			{
				ELOG("app")->error(WCOOL(L"邀请加入群时,服务器返回未知错误类型!") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml());
				callback_(true,XL("biz.InviteIntoGroups.fail"));
			}
		}else{
			callback_(false,XL(""));
		}
	}
Exemplo n.º 11
0
  void Disco::handleIqID( const IQ& iq, int context )
  {
    DiscoHandlerMap::iterator it = m_track.find( iq.id() );
    if( it != m_track.end() && (*it).second.dh )
    {
      switch( iq.subtype() )
      {
        case IQ::Result:
          switch( context )
          {
            case GetDiscoInfo:
            {
              const Info* di = iq.findExtension<Info>( ExtDiscoInfo );
              if( di )
                (*it).second.dh->handleDiscoInfo( iq.from(), *di, (*it).second.context );
              break;
            }
            case GetDiscoItems:
            {
              const Items* di = iq.findExtension<Items>( ExtDiscoItems );
              if( di )
                (*it).second.dh->handleDiscoItems( iq.from(), *di, (*it).second.context );
              break;
            }
          }
          break;

        case IQ::Error:
        {
          (*it).second.dh->handleDiscoError( iq.from(), iq.error(), (*it).second.context );
          break;
        }

        default:
          break;
      }

      m_track.erase( it );
    }
  }
Exemplo n.º 12
0
	/*
	
	<iq type=’result’from=’groups.ruijie.com.cn’ to=’[email protected]/pc’>
	<query xmlns=’groups:list’>
	<item id=’112’ name=’吃货群’ icon=”icon_url”v=”false” alert=”1”/>
	<item id=’113’ name=’开心群’ icon=”icon_url”v=”false” alert=”0”/>
	…
	</query>
	</iq>
*/
	void GetGroupsListHandler::handleIqID( const IQ& iq, int context )
	{
		json::jobject jobj;
		if (iq.m_subtype != gloox::IQ::Result)
		{
			const Error* e = iq.error();
			if (!e)
			{
				callback_(true,XL("biz.GetGroupsList.fail"),jobj);
				return;
			}

			if ( e->error() == StanzaErrorBadRequest)
			{
				ELOG("app")->error(WCOOL(L"取群列表时,请求协议错误!。"));
				callback_(true,XL("biz.crwod.iq_error.bad-request"),jobj);
			}
			else if (e->error() == StanzaErrorInternalServerError)
			{
				ELOG("app")->error(WCOOL(L"取群列表时,处理错误(服务器处理错误)。"));
				callback_(true,XL("biz.crwod.iq_error.internal-server-error"),jobj);
			}
			else if (e->error() == StanzaErrorItemNotFound)
			{
				ELOG("app")->error(WCOOL(L"取群列表时,找不到此群。"));
				callback_(true,XL("biz.crwod.iq_error.item-not-found"),jobj);
			}else
			{
				ELOG("app")->error(WCOOL(L"取群列表时,服务器返回未知错误类型!") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml());
				callback_(true,XL("biz.GetGroupsList.fail"),jobj);
			}

		}else{
			if(iq.findExtension(kExtUser_iq_filter_getgroupslist))
			{
				boost::shared_ptr<gloox::Tag> tag(iq.findExtension(kExtUser_iq_filter_getgroupslist)->tag());
				if (tag)
				{
					//循环取得item
					gloox::TagList items;
					items = tag->findChildren("item");
					TagList::const_iterator it = items.begin();
					for( ; it != items.end(); ++it )
					{
						json::jobject data;
						data["session_id"] = gWrapInterface::instance().append_groups_domain((*it)->findAttribute( "id" ));
						data["remark"] = (*it)->findAttribute( "remark" );
						data["name"] = (*it)->findAttribute( "name" );
						data["icon"]  = (*it)->findAttribute( "icon" );
						data["official"] = (*it)->findAttribute( "v" );
						data["alert"] = (*it)->findAttribute( "alert" );
						data["role"] = (*it)->findAttribute( "role" );
						data["quit"] = (*it)->findAttribute( "quit" );
						data["status"] = (*it)->findAttribute( "status" );
						data["dismiss"] = (*it)->findAttribute( "dismiss" );
						data["active"] = (*it)->findAttribute( "active" );
						data["category"] = (*it)->findAttribute( "category" );
						jobj.arr_push(data);
					}

					if (!callback_.empty())
					{
						callback_(false, XL(""), jobj);
					}

					return;
				}
			}

			ELOG("app")->error(WCOOL(L"取群列表时服务端返回的数据格式错误。") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml());
			if (!callback_.empty())
			{
				universal_resource error_desc;
				error_desc = XL("biz.GetGroupsList.fail");
				callback_(true, error_desc, jobj);
			}
		}
	}
Exemplo n.º 13
0
	void whistleVcardHandler::handleIqID( const IQ& iq, int context )
	{
		switch( iq.subtype() )
		{
		case IQ::Result:
			{
				switch( context )
				{
				case VCardHandler::FetchVCard:
					{
						json::jobject jobj;
						json::jobject status = json::jobject();
						if (iq.findExtension( ExtVCard ))
						{
							boost::shared_ptr<gloox::Tag> ptag(iq.findExtension( ExtVCard )->tag());
							for (TagList::const_iterator cit = ptag->children().begin(); cit != ptag->children().end(); ++cit) {
								Tag* ptag = *cit;
								if (ptag->name() == s_VcardPrivacy)
								{
									jobj[ptag->name()] = json::jobject(ptag->cdata());
								}
								else if (ptag->name() == s_VcardStatus)
								{
									//获取vcard协议改变 新的解析iq
									Tag* presource = ptag->findChild("resource");
									Tag* pshow = ptag->findChild("show");
									if ( presource && pshow)
									{
										json::jobject itemdata;
										itemdata["resource"] = presource->cdata();
										itemdata["show"] = pshow->cdata();
										status.arr_push(itemdata);
									}
								}
								else
								{
									jobj[ptag->name()] = ptag->cdata();
								}
							}
							jobj[s_VcardJid] = iq.from().bare();

							gwhistleVcard::instance().handleVCard(iq.from(), jobj, status, waitCallback_);
						}
						break;
					}
				case VCardHandler::StoreVCard:
					gwhistleVcard::instance().handleVCardResult(VCardHandler::StoreVCard, iq.from());
					break;
				}
			}
			break;
		case IQ::Error:
			{
				switch( context )
				{
				case VCardHandler::FetchVCard:
					if (!waitCallback_.empty())
					{
						waitCallback_();
					}
					else
					{
						gwhistleVcard::instance().updatedVcard(iq.from());
					}
					break;
				case VCardHandler::StoreVCard:
					gwhistleVcard::instance().handleVCardResult( (VCardHandler::VCardContext)context,
						iq.from(),
						iq.error() ? iq.error()->error()
						: StanzaErrorUndefined );
					break;
				}
			}
		default:
			break;
		}
	}
Exemplo n.º 14
0
  void PrivacyManager::handleIqID( const IQ& iq, int context )
  {
    if( !m_privacyListHandler )
      return;

    switch( iq.subtype() )
    {
      case IQ::Result:
        switch( context )
        {
          case PLStore:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultStoreSuccess );
            break;
          case PLActivate:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultActivateSuccess );
            break;
          case PLDefault:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultDefaultSuccess );
            break;
          case PLRemove:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultRemoveSuccess );
            break;
          case PLRequestNames:
          {
            const Query* q = iq.findExtension<Query>( ExtPrivacy );
            if( !q )
              return;
            m_privacyListHandler->handlePrivacyListNames( q->def(), q->active(),
                                                          q->names() );
            break;
          }
          case PLRequestList:
          {
            const Query* q = iq.findExtension<Query>( ExtPrivacy );
            if( !q )
              return;
            m_privacyListHandler->handlePrivacyList( q->name(), q->items() );
            break;
          }
        }
        break;

      case IQ::Error:
      {
        switch( iq.error()->error() )
        {
          case StanzaErrorConflict:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultConflict );
            break;
          case StanzaErrorItemNotFound:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultItemNotFound );
            break;
          case StanzaErrorBadRequest:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultBadRequest );
            break;
          default:
            m_privacyListHandler->handlePrivacyListResult( iq.id(), ResultUnknownError );
            break;
        }
        break;
      }

      default:
        break;
    }
  }
	void GetGroupsShareListHandler::handleIqID( const IQ& iq, int context )
	{
		json::jobject jobj,items,sets;
		if (iq.m_subtype != gloox::IQ::Result)
		{
			const Error* e = iq.error();
			if (!e)
			{
				callback_(true,XL("biz.GetGroupsShareList.fail"),jobj);
				return;
			}
			if ( e->error() == StanzaErrorBadRequest)
			{
				ELOG("app")->error(WCOOL(L"取群共享列表时,请求协议错误!。"));
				callback_(true,XL("biz.crwod.iq_error.bad-request"),jobj);
			}
			else if (e->error() == StanzaErrorInternalServerError)
			{
				ELOG("app")->error(WCOOL(L"取群共享列表时,处理错误(服务器处理错误)。"));
				callback_(true,XL("biz.crwod.iq_error.internal-server-error"),jobj);
			}
			else if (e->error() == StanzaErrorItemNotFound)
			{
				ELOG("app")->error(WCOOL(L"取群共享列表时,找不到此群。"));
				callback_(true,XL("biz.crwod.iq_error.item-not-found"),jobj);
			}else
			{
				ELOG("app")->error(WCOOL(L"取群共享列表时,服务器返回未知错误类型!") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml());
				callback_(true,XL("biz.GetGroupsShareList.fail"),jobj);
			}

		}else{
			if(iq.findExtension(kExtUser_iq_filter_getgroupssharelist))
			{
				boost::shared_ptr<gloox::Tag> tag(iq.findExtension(kExtUser_iq_filter_getgroupssharelist)->tag());
				if (tag)
				{
					//循环取得item
					gloox::TagList item;
					item = tag->findChildren("item");
					TagList::const_iterator it = item.begin();

					gloox::Tag* setTag = tag->findChild("set");
					if (setTag)
					{
						if (setTag->findChild( "index" ))
						{
							sets["index"]= setTag->findChild( "index" )->findCData( "index" );
						}
						if (setTag->findChild( "max" ))
						{
							sets["max"]= setTag->findChild( "max" )->findCData( "max" );
						}
						if (setTag->findChild( "total" ))
						{
							sets["total"]= setTag->findChild( "total" )->findCData( "total" );
						}
					}
					
					jobj["set"]=sets;
					for( ; it != item.end(); ++it )
					{
						json::jobject data;
						
						data["id"] = (*it)->findAttribute( "id" );
						data["name"] = (*it)->findAttribute( "name" );
						data["size"]  = (*it)->findAttribute( "size" );
						data["owner_jid"] = (*it)->findAttribute( "owner_jid" );
						
						if ((*it)->findAttribute( "download_count" ).empty())
						{
							data["download_count"] = "0";
						}
						else
						{
							data["download_count"] = (*it)->findAttribute( "download_count" );
						}
						
						std::string timestamp = (*it)->findAttribute( "create_time" );
						data["timestamp"] = timestamp;
						if (!timestamp.empty())
						{
							boost::posix_time::ptime t = boost::posix_time::from_time_t(boost::lexical_cast<intmax_t>(timestamp)/1000);
							boost::posix_time::ptime local_time = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(t);
							data["create_time"] = epius::time_format(local_time);
						}
						else
						{
							data["create_time"] = "";
						}
						
						data["owner_name"] = (*it)->findAttribute( "owner_name" );
						data["uri"] = (*it)->findAttribute( "uri" );
						items.arr_push(data);
					}
					jobj["list"]=items;
					if (!callback_.empty())
					{
						callback_(false, XL(""), jobj);
					}

					return;
				}
			}

			ELOG("app")->error(WCOOL(L"取群共享列表时服务端返回的数据格式错误。") + boost::shared_ptr<gloox::Tag>(iq.tag())->xml());
			if (!callback_.empty())
			{
				universal_resource error_desc;
				error_desc = XL("biz.GetGroupsShareList.fail");
				callback_(true, error_desc, jobj);
			}
		}
	}
Exemplo n.º 16
0
  void Registration::handleIqID( const IQ& iq, int context )
  {
    if( !m_registrationHandler )
      return;

    if( iq.subtype() == IQ::Result )
    {
      switch( context )
      {
        case FetchRegistrationFields:
        {
          const Query* q = iq.findExtension<Query>( ExtRegistration );
          if( !q )
            return;

          if( q->registered() )
            m_registrationHandler->handleAlreadyRegistered( iq.from() );

          if( q->form() )
            m_registrationHandler->handleDataForm( iq.from(), *(q->form()) );

          if( q->oob() )
            m_registrationHandler->handleOOB( iq.from(), *(q->oob()) );

          m_registrationHandler->handleRegistrationFields( iq.from(), q->fields(), q->instructions() );
          break;
        }

        case CreateAccount:
        case ChangePassword:
        case RemoveAccount:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationSuccess );
          break;
      }
    }
    else if( iq.subtype() == IQ::Error )
    {
      const Error* e = iq.error();
      if( !e )
        return;

      switch( e->error() )
      {
        case StanzaErrorConflict:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationConflict );
          break;
        case StanzaErrorNotAcceptable:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationNotAcceptable );
          break;
        case StanzaErrorBadRequest:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationBadRequest );
          break;
        case StanzaErrorForbidden:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationForbidden );
          break;
        case StanzaErrorRegistrationRequired:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationRequired );
          break;
        case StanzaErrorUnexpectedRequest:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationUnexpectedRequest );
          break;
        case StanzaErrorNotAuthorized:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationNotAuthorized );
          break;
        case StanzaErrorNotAllowed:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationNotAllowed );
          break;
        default:
          m_registrationHandler->handleRegistrationResult( iq.from(), RegistrationUnknownError );
          break;

      }
    }

  }