當前位置: 首頁>>代碼示例>>C++>>正文


C++ FindClient函數代碼示例

本文整理匯總了C++中FindClient函數的典型用法代碼示例。如果您正苦於以下問題:C++ FindClient函數的具體用法?C++ FindClient怎麽用?C++ FindClient使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FindClient函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的FindClient函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。