当前位置: 首页>>代码示例>>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;未经允许,请勿转载。