• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindClient函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FindClient函数的典型用法代码示例。如果您正苦于以下问题:C++ FindClient函数的具体用法?C++ FindClient怎么用?C++ FindClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FindClient函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: KickBan

void
KickBan(int ban, char *source, struct Channel *channel, char *nicks, char *reason)

{
  char *mask, *tempnix, **av, *bans;
  char temp[MAXLINE];
  int ac, ii;
  struct Luser *lptr;

  if (!source || !channel || !nicks)
    return;

  tempnix = MyStrdup(nicks);
  ac = SplitBuf(tempnix, &av);

  if (ban)
  {
    bans = (char *) MyMalloc(sizeof(char));
    bans[0] = '\0';
    for (ii = 0; ii < ac; ii++)
    {
      if (!(lptr = FindClient(av[ii])))
        continue;
      mask = HostToMask(lptr->username, lptr->hostname);
      ircsprintf(temp, "*!%s", mask);
      bans = (char *) MyRealloc(bans, strlen(bans)
          + strlen(temp) + (2 * sizeof(char)));
      strcat(bans, temp);
      strcat(bans, " ");
      MyFree(mask);
    }

    SetModes(source, 1, 'b', channel, bans);
    MyFree(bans);
  }

  for (ii = 0; ii < ac; ii++)
  {
    toserv(":%s REMOVE %s %s :%s\n",
      source,
      channel->name,
      av[ii],
      reason ? reason : "");
    RemoveFromChannel(channel, FindClient(av[ii]));
  }

  MyFree(tempnix);
  MyFree(av);
} /* KickBan() */
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:49,代码来源:channel.c


示例2: if

//Sends the actual message
bool Server::SendString(int ID, std::string & _string)
{
	if(_string.find("InitChess") != std::string::npos)
	{
		if (!SendPacketType(ID, P_GameStateChange)) 
		return false; 
	}
	else if(_string.find("MOVE:") != std::string::npos)
	{
		if (!SendPacketType(ID, P_ChessMove))
		return false;
	}
	else
	{
		if (!SendPacketType(ID, P_ChatMessage)) 
			return false; 
	}
	int bufferlength = _string.size(); 
	if (!SendInt(ID, bufferlength)) 
		return false; 
	int RetnCheck = send(players[FindClient(ID)].connection, _string.c_str(), bufferlength, NULL); 
	if (RetnCheck == SOCKET_ERROR) 
		return false; 
	return true; 
}
开发者ID:isaac109,项目名称:BattleNet_Chess,代码行数:26,代码来源:SendGetMethods.cpp


示例3: recv

//Retrieves the type of message
bool Server::GetPacketType(int ID, Packet & _packettype)
{
	int RetnCheck = recv(players[FindClient(ID)].connection, (char*)&_packettype, sizeof(Packet), NULL); 
	if (RetnCheck == SOCKET_ERROR) 
		return false; 
	return true;
}
开发者ID:isaac109,项目名称:BattleNet_Chess,代码行数:8,代码来源:SendGetMethods.cpp


示例4: send

//Sends the size of the message first
bool Server::SendInt(int ID, int _int)
{
	int RetnCheck = send(players[FindClient(ID)].connection, (char*)&_int, sizeof(int), NULL); 
	if (RetnCheck == SOCKET_ERROR) 
		return false; 
	return true; 
}
开发者ID:isaac109,项目名称:BattleNet_Chess,代码行数:8,代码来源:SendGetMethods.cpp


示例5: FindClient

void CClientMgr::SetClientAuthSucceed(int32 clientid)
{
	CClient *cl = FindClient(clientid);
	if (!cl)
		return;
	cl->SetAlreadyAuth();
}
开发者ID:Ding8222,项目名称:mytest,代码行数:7,代码来源:ClientMgr.cpp


示例6: ChooseWindow

/** Select a window for performing an action. */
void ChooseWindow(const MenuAction *action)
{

   XEvent event;
   ClientNode *np;

   GrabMouseForChoose();

   for(;;) {

      WaitForEvent(&event);

      if(event.type == ButtonPress) {
         if(event.xbutton.button == Button1) {
            np = FindClient(event.xbutton.subwindow);
            if(np) {
               client = np;
               RunWindowCommand(action);
            }
         }
         break;
      } else if(event.type == KeyPress) {
         break;
      }

   }

   JXUngrabPointer(display, CurrentTime);

}
开发者ID:KarlGodt,项目名称:jwm,代码行数:31,代码来源:winmenu.c


示例7: RemoveNickFromChannel

void
RemoveNickFromChannel(char *channel, char *nickname)

{
  struct Channel *cptr;
  struct Luser *lptr;
  char *tmp;

  tmp = channel;

  if (IsNickPrefix(*tmp))
  {
    if (IsNickPrefix(*(++tmp)))
      ++tmp;
  }

  if (!(cptr = FindChannel(tmp)))
    return;

  tmp = GetNick(nickname);
  if (!(lptr = FindClient(tmp)))
    return;

  RemoveFromChannel(cptr, lptr);
} /* RemoveNickFromChannel() */
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:25,代码来源:channel.c


示例8: ss_process

void
ss_process(char *nick, char *command)

{
	int acnt;
	char **arv;
	struct Command *sptr;
	struct Luser *lptr;

	if (!command || !(lptr = FindClient(nick)))
		return;

	if (Network->flags & NET_OFF)
	{
		notice(n_StatServ, lptr->nick,
		       "Services are currently \002disabled\002");
		return;
	}

	acnt = SplitBuf(command, &arv);
	if (acnt == 0)
	{
		MyFree(arv);
		return;
	}

	sptr = GetCommand(statcmds, arv[0]);

	if (!sptr || (sptr == (struct Command *) -1))
	{
		notice(n_StatServ, lptr->nick,
		       "%s command [%s]",
		       (sptr == (struct Command *) -1) ? "Ambiguous" : "Unknown",
		       arv[0]);
		MyFree(arv);
		return;
	}

	/*
	 * Check if the command is for admins only - if so,
	 * check if they match an admin O: line.  If they do,
	 * check if they are registered with OperServ,
	 * if so, allow the command
	 */
	if ((sptr->level == LVL_ADMIN) && !(IsValidAdmin(lptr)))
	{
		notice(n_StatServ, lptr->nick, "Unknown command [%s]",
		       arv[0]);
		MyFree(arv);
		return;
	}

	/* call sptr->func to execute command */
	(*sptr->func)(lptr, acnt, arv);

	MyFree(arv);

	return;
} /* ss_process() */
开发者ID:Cloudxtreme,项目名称:hybserv2,代码行数:59,代码来源:statserv.c


示例9: RelayMSG

void RelayMSG(HWND hWnd,clientStruct *clients,SOCKET outSocket)
{
	//	This function will relay messages to the designated client(s)

	BOOLEAN sendAll = FALSE;
	TCHAR tmpBuffer[BUFFER_SIZE];
	clientStruct *tmpClients=clients;
	clientStruct dataToSend={'\0'};

	DisplayError(NULL,TEXT(__FUNCSIG__),0,LOG|WINDOW,NOTICE);

	// Find the Sender
	while((tmpClients!=NULL) && (tmpClients->inSocket!=outSocket))
	{
		tmpClients=tmpClients->next;
	}
	_tcscpy(dataToSend.nickName,tmpClients->nickName);
	_tcscpy(dataToSend.sendMSG,tmpClients->sendMSG);
	_tcscpy(dataToSend.sendTo,tmpClients->sendTo);

	// Sender not found so leave

	if(tmpClients==NULL)
		return;

	if(_tcscmp(clients->sendTo,TEXT("PUBLIC"))==0)
	{
		sendAll=TRUE;
		StringCbPrintf(tmpBuffer,BUFFER_SIZE,TEXT("Relaying incoming message to %s "),TEXT("all users"));
	}
	else
		StringCbPrintf(tmpBuffer,BUFFER_SIZE,TEXT("Relaying incoming message to %s "),clients->sendTo);

	DisplayError(NULL,tmpBuffer,0,LOG,NOTICE);
	// Store sender details

	if (sendAll) // Send to all except the sender
	{
#pragma warning(suppress: 6303)
		// Display message in server log window if it's open
		if(hWnd!=NULL)
		{
			StringCbPrintf(tmpBuffer,BUFFER_SIZE,TEXT("Message from %s: %s "),clients->nickName,clients->sendMSG);
			SendMessage(hWnd,LB_ADDSTRING, 0, (LPARAM)tmpBuffer);
		}

		while(tmpClients!=NULL)													// Send to all users except the sender
		{
			if(tmpClients->inSocket!=outSocket)
				send(tmpClients->inSocket,(char*)&dataToSend,sizeof(clientStruct),0);
			tmpClients=tmpClients->next;
		}
	}
	else																		// Send a single user
	{
		clientStruct singleClient =  FindClient(clients,clients->sendTo);
		send(singleClient.inSocket,(char*)&dataToSend,sizeof(clientStruct),0);
	}
}
开发者ID:dmcgold,项目名称:ChatProgram,代码行数:59,代码来源:Network.cpp


示例10: SDL_LockMutex

int mythStreamServer::AppendClient(mythBaseClient* client) {
    SDL_LockMutex(streamservermutex);
    if (!FindClient(baselist.begin(), baselist.end(), client)) {
        baselist.push_back(client);
    }
    SDL_UnlockMutex(streamservermutex);
    return 0;
}
开发者ID:godka,项目名称:mythCameraClient,代码行数:8,代码来源:mythStreamServer.cpp


示例11: FindClient

// ---------------------------------------------------------------------------
// Returns the current status of the given session.
// ---------------------------------------------------------------------------
//
MHWRMHapticsObserver::THWRMHapticsStatus
CHWRMHapticsCommonData::CurrentStatus( const CSession2* aSession ) const
    {
    // get the index of the client
    TInt index = FindClient( aSession );

    return iClientArray[index]->iStatus;
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:12,代码来源:hwrmhapticscommondata.cpp


示例12: FindClient

	int TLServer_IP::ClearStocks(CString clientname)
	{
		int cid = FindClient(clientname);
		if (cid==-1) return CLIENTNOTREGISTERED;
		stocks[cid] = clientstocklist(0);
		HeartBeat(clientname);
		D(CString(_T("Cleared stocks for ")+clientname));
		return OK;
	}
开发者ID:Decatf,项目名称:tradelink,代码行数:9,代码来源:TLServer_IP.cpp


示例13: FindClient

bool CTCPServerProxied::OnIncomingData(const std::string &token, const unsigned char *data, size_t bytes_transferred)
{
	CSharedClient *client = FindClient(token);
	if (client == NULL) {
		return false;
	}
	client->OnIncomingData(data, bytes_transferred);
	return true;
}
开发者ID:PatchworkBoy,项目名称:domoticz,代码行数:9,代码来源:TCPServer.cpp


示例14: es_seennick

/*
 * es_seennick()
 *
 * Give lptr seen info on av[1] nick (exact match)
 */
static void es_seennick(struct Luser *lptr, int ac, char **av)
{
    aSeen *seen, *recent, *saved = NULL;
    struct Luser *aptr;

    if (ac < 2)
    {
        notice(n_SeenServ, lptr->nick,
               "Syntax: SEENNICK <nickname>");
        notice(n_SeenServ, lptr->nick,
               ERR_MORE_INFO,
               n_SeenServ,
               "SEENNICK");
        return ;
    }

    if ((aptr = FindClient(av[1])))
    {
        notice(n_SeenServ, lptr->nick, "%s is on IRC right now!", aptr->nick);
        return ;
    }

    for (seen = seenp; seen; seen = seen->prev)
    {
        if (!irccmp(seen->nick, av[1]))
        {
            seen->seen = saved;
            saved = seen;
        }
    }

    if (saved)
    {
        recent = saved;
        for (; saved; saved = saved->seen)
        {
            if (saved->time > recent->time)
                recent = saved;
        }
        if (recent->type == 1)
        {
            notice(n_SeenServ, lptr->nick, "I last saw %s (%s) %s ago, quiting: %s", recent->nick,
                   recent->userhost, timeago(recent->time, 0), recent->msg);
        }
        else if (recent->type == 2)
        {
            notice(n_SeenServ, lptr->nick, "I last saw %s (%s) %s ago, changing nicks", recent->nick,
                   recent->userhost, timeago(recent->time, 0));
        }
    }
    else
    {
        notice(n_SeenServ, lptr->nick, "I haven't seen %s recently", av[1]);
    }

} /* es_seennick */
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:61,代码来源:seenserv.c


示例15: FindClient

void CNifManSubConnectionShim::ConnectionLeaving(const CConnection& aConnection)
	{//destroy a CSubConnectionLinkShimClient belonging to leaving conection
	TInt i = FindClient(aConnection);
	if ( i >= 0 )
		{
		CSubConnectionLinkShimClient* client = iShimClients[i];
		iShimClients.Remove(i);
		delete client;
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:10,代码来源:shimnifmansconn.cpp


示例16: FindClient

BOOL MyIOCP::BuildStartFileTransferPackageAndSend(int ClientID)
{
	BOOL bRet=FALSE;
	m_ContextMapLock.Lock();
	ClientContext* pContext = FindClient(ClientID);
	if (pContext == NULL)
		return FALSE;
	bRet= BuildStartFileTransferPackageAndSend(pContext);
	m_ContextMapLock.Unlock();
	return bRet;
}
开发者ID:jeppeter,项目名称:IOCP,代码行数:11,代码来源:MyIOCP.cpp


示例17: GetChatClient

//By Luiz45 - Just Return the ChatClient(he will search through CharName)
ChatClient* ChatManager::GetChatClient(WCHAR* pCharName){
	for (cliIt it = cList.begin(); it != cList.end(); ++it)
	{
		if (FindClient(it->second))
		{
			if (wcscmp(it->second->GetCharName(), pCharName) == 0)
				return it->second;
		}
	}
	return NULL;
}
开发者ID:ChowZenki,项目名称:dboserver,代码行数:12,代码来源:ChatManager.cpp


示例18: mo_kill

/*
 * mo_kill - oper message handler
 *
 * NOTE: IsPrivileged(sptr), IsAnOper(sptr) == true
 *       IsServer(cptr), IsServer(sptr) == false
 *
 * parv[0]      = sender prefix
 * parv[1]      = kill victim
 * parv[parc-1] = kill path
 */
int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
  struct Client* victim;
  char*          user;
  char           msg[TOPICLEN + 3]; /* (, ), and \0 */

  assert(0 != cptr);
  assert(0 != sptr);
  /*
   * oper connection to this server, cptr is always sptr
   */
  assert(cptr == sptr);
  assert(IsAnOper(sptr));

  if (parc < 3 || EmptyString(parv[parc - 1]))
    return need_more_params(sptr, "KILL");

  user = parv[1];
  ircd_snprintf(0, msg, sizeof(msg), "(%.*s)", TOPICLEN, parv[parc - 1]);

  if (!(victim = FindClient(user))) {
    /*
     * If the user has recently changed nick, we automaticly
     * rewrite the KILL for this new nickname--this keeps
     * servers in synch when nick change and kill collide
     */
    if (!(victim = get_history(user, (long)15)))
      return send_reply(sptr, ERR_NOSUCHNICK, user);

    sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Changed KILL %s into %s", sptr,
		  user, cli_name(victim));
  }
  if (!HasPriv(sptr, MyConnect(victim) ? PRIV_LOCAL_KILL : PRIV_KILL))
    return send_reply(sptr, ERR_NOPRIVILEGES);

  if (IsServer(victim) || IsMe(victim)) {
    return send_reply(sptr, ERR_CANTKILLSERVER);
  }
  /*
   * if the user is +k, prevent a kill from local user
   */
  if (IsChannelService(victim))
    return send_reply(sptr, ERR_ISCHANSERVICE, "KILL", cli_name(victim));


  if (!MyConnect(victim) && !HasPriv(sptr, PRIV_KILL)) {
    sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Nick %s isnt on your server",
		  sptr, cli_name(victim));
    return 0;
  }
  return do_kill(cptr, sptr, victim, cli_user(sptr)->host, cli_name(sptr),
		 msg);
}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.11.07,代码行数:63,代码来源:m_kill.c


示例19: RegisterClient

	int TLServer_IP::RegisterClient(CString  clientname)
	{
		if (FindClient(clientname)!=-1) return OK;
		client.push_back(clientname);
		time_t now;
		time(&now);
		heart.push_back(now); // save heartbeat at client index
		clientstocklist my = clientstocklist(0);
		stocks.push_back(my);
		D(CString(_T("Client ")+clientname+_T(" connected.")));
		return OK;
	}
开发者ID:Decatf,项目名称:tradelink,代码行数:12,代码来源:TLServer_IP.cpp



注:本文中的FindClient函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindClose函数代码示例发布时间:2022-05-30
下一篇:
C++ FindChunk函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap