virtual bool OnLoad(const CString& sArgs, CString& sMessage) { // Load the chans from the command line unsigned int a = 0; VCString vsChans; sArgs.Split(" ", vsChans, false); for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) { CString sName = "Args"; sName += CString(a); AddUser(sName, "*", *it); } // Load the saved users for (MCString::iterator it = BeginNV(); it != EndNV(); it++) { const CString& sLine = it->second; CAutoVoiceUser* pUser = new CAutoVoiceUser; if (!pUser->FromString(sLine) || FindUser(pUser->GetUsername().AsLower())) { delete pUser; } else { m_msUsers[pUser->GetUsername().AsLower()] = pUser; } } return true; }
int ClientManager::packet_send_msg_proc(ObjectUser::User* p_user) { ObjectUser *pObjectUser = FindUser(p_user->id); if (pObjectUser != NULL) { p_user->id = pObjectUser->sUser_info.id; pObjectUser->Set_Msg("org\n"); #if 1 DWORD writen = 0; /* return message by send socket */ if (WSASend(p_user->id, (WSABUF*)&pc_socket_info->dataBuf, 1, (DWORD *)&writen, 0, &pc_socket_info->overlapped, NULL) == SOCKET_ERROR) { if (WSAGetLastError() != WSA_IO_PENDING) { printf("WSASend Error.. [%d] \n", WSAGetLastError()); } } #endif broadcast_userinfo(p_user->id, &pObjectUser->sUser_info); } return true; }
bool CTCPServerInt::HandleAuthentication(CTCPClient_ptr c, const std::string &username, const std::string &password) { _tRemoteShareUser *pUser=FindUser(username); if (pUser==NULL) return false; return ((pUser->Username==username)&&(pUser->Password==password)); }
void UsersGroup::Join(NetworkDefs::TUiid uuid, std::shared_ptr<IUser> user) { auto existingUser = FindUser(uuid); if (!existingUser) { m_users.emplace(std::make_pair(uuid, user)); } }
void UsersGroup::Deliver(NetworkDefs::TUiid uuid, std::shared_ptr<NetworkUtils::NetworkMessage>& message) { auto user = FindUser(uuid); if (user) { user->Deliver(message); } }
void RosterView::UnlinkUser(UserID *removed_user) { Window()->Lock(); uint32 index = FindUser(removed_user); if (index >= 0) RemoveItem(index); Window()->Unlock(); }
void SessionImpl::AddUser(const UserPtr& newUser) { UserPtr existingUser = FindUser(newUser->GetID()); if (!existingUser) { m_users.push_back(newUser); } }
bool CMac::AddLogin(CString sUsername, CString sPassword, CString sIRCUsername, CString sHost, CString sIdentd) { if(FindLogin(sIRCUsername)) return false; user *pUser=FindUser(sUsername); if(!pUser) return false; if(pUser) if(CheckPassword(sPassword, pUser)) { if(pUser->sHost.Compare("")) if(!strstr(sHost.CStr(), pUser->sHost.CStr())) return false; login *pLogin=new login; pLogin->pUser=pUser; pLogin->sUsername=sUsername; pLogin->sIRCUsername=sIRCUsername; llStart.push_back(pLogin); return true; } return false; }
/* * ms_whois - server message handler * * parv[0] = sender prefix * parv[1] = nickname masklist * * or * * parv[1] = target server, or a nickname representing a server to target. * parv[2] = nickname masklist */ int ms_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { char* nick; char* tmp; char* p = 0; int found = 0; int total = 0; if (parc < 2) { send_reply(sptr, ERR_NONICKNAMEGIVEN); return 0; } if (parc > 2) { if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) != HUNTED_ISME) return 0; parv[1] = parv[2]; } total = 0; for (tmp = parv[1]; (nick = ircd_strtok(&p, tmp, ",")); tmp = 0) { struct Client *acptr = 0; found = 0; collapse(nick); acptr = FindUser(nick); if (acptr && !IsServer(acptr)) { found++; do_whois(sptr, acptr, parc); } if (!found) send_reply(sptr, ERR_NOSUCHNICK, nick); total+=found; if (total >= MAX_WHOIS_LINES) { send_reply(sptr, ERR_QUERYTOOLONG, parv[1]); break; } if (p) p[-1] = ','; } /* of tokenised parm[1] */ send_reply(sptr, RPL_ENDOFWHOIS, parv[1]); return 0; }
void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) { debugLogA("CVkProto::OnReceiveUserInfo %d", reply->resultCode); if (reply->resultCode != 200) return; JSONROOT pRoot; JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); if (pResponse == NULL) return; for (size_t i=0; ; i++) { JSONNODE *pRecord = json_at(pResponse, i); if (pRecord == NULL) break; LONG userid = json_as_int( json_get(pRecord, "uid")); if (userid == 0) return; MCONTACT hContact; if (userid == m_myUserId) hContact = NULL; else if ((hContact = FindUser(userid, false)) == NULL) return; CMString tszNick; ptrT szValue( json_as_string( json_get(pRecord, "first_name"))); if (szValue) { setTString(hContact, "FirstName", szValue); tszNick.Append(szValue); tszNick.AppendChar(' '); } if (szValue = json_as_string( json_get(pRecord, "last_name"))) { setTString(hContact, "LastName", szValue); tszNick.Append(szValue); } if (!tszNick.IsEmpty()) setTString(hContact, "Nick", tszNick); setByte(hContact, "Gender", json_as_int( json_get(pRecord, "sex")) == 2 ? 'M' : 'F'); if (szValue = json_as_string( json_get(pRecord, "bdate"))) { int d, m, y; if ( _stscanf(szValue, _T("%d.%d.%d"), &d, &m, &y) == 3) { setByte(hContact, "BirthDay", d); setByte(hContact, "BirthMonth", m); setWord(hContact, "BirthYear", y); } } szValue = json_as_string( json_get(pRecord, "photo_medium")); SetAvatarUrl(hContact, szValue); } }
int ClientManager::Recv_Client_Packet(SOCKETINFO* socket_info, BYTE* packet) { EnterCriticalSection(&cs); ObjectUser *pObjectUser = FindUser(socket_info->fd); //유저 구조체에서 소켓정보 빼올수있는지 실험 -> 성공 //pc_socket_info = socket_info; pc_socket_info = pObjectUser->user_socket_info; if (pObjectUser != NULL) { CStream* pStream = *pStreamSP; /****************/ /* Open Stream */ /****************/ pStream->StartRead(); USHORT P_Header = Read_Stream_Header(*pStreamSP, packet); switch (P_Header) { case P_SEND_MSG: packet_send_msg_proc(&pObjectUser->sUser_info); break; case P_MOVE_POS: packet_move_proc(&pObjectUser->sUser_info); break; case P_BROAD_CAST_MSG: /* broad casting */ broadcast_userinfo(pObjectUser->sUser_info.id, &pObjectUser->sUser_info); //pClientManager->broadcast_userinfo_zone(sInfo->fd, pOvluser); break; case P_LOBBY_MSG: //recv_packet_user_join_room(pObjectUser->sUser_info.id); packet_lobby_proc(pObjectUser, pc_socket_info, pStreamSP); break; //16.05.31 case P_CLIENT_TO_SERVER_MSG: packet_client_to_server_proc(&pObjectUser->sUser_info, pc_socket_info); break; //16.06.09 case P_BATTLE_MSG: recv_packet_battle_proc(pObjectUser, pStreamSP); break; case P_MAX: break; } /****************/ /* Close Stream */ /****************/ pStream->EndRead(); } /* need mutext */ LeaveCriticalSection(&cs); return true; }
void foo() { if (mask && ((mask[0] == '\0') || (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*'))))) mask = NULL; if ((acptr = FindUser(nick)) && ((!(bitsel & WHOSELECT_OPER)) || IsAnOper(acptr)) && Process(acptr) && SHOW_MORE(sptr, counter)) mask = NULL; }
UINT16 CUserMgr::CkUser(UINT32 &dwUserID, TCHAR *pszZoneName, UINT8 byAuthType, UINT8 byAuthMethod, UINT32 dwPlayerID, UINT16 wCareerID, TCHAR* pszUserName, TCHAR* pszPasswd, TCHAR* pszDeviceID, TCHAR* pszNotifyID, UINT16 wZoneID, UINT32 dwCliVer) { CSDMutexLock lock(m_oMutex); CUser* poUser = FindUser(dwPlayerID); if(NULL == poUser) { return ERR_COMMON::ID_OTHER_ERR; } return poUser->CkUser(dwUserID, pszZoneName, dwPlayerID, byAuthType, byAuthMethod, pszUserName, pszPasswd, pszDeviceID, pszNotifyID, wCareerID, wZoneID, dwCliVer); }
int ClientManager::packet_broadcasttest_proc(ObjectUser::User* p_user) { ObjectUser *pObjectUser = FindUser(p_user->id); if (pObjectUser != NULL) { } return true; }
void COmokRoom::SendTo(SOCKET you, const char* str, int msglen) { EVENTSOCKET* temp = FindUser(you); if(temp == NULL) return ; SOCKET s = temp->sSocket; send(s, str, msglen, 0); }
int COmokRoom::AddUser(EventSocket evuser) { EVENTSOCKET* temp = FindUser(evuser.sSocket); if(temp == NULL) { this->m_UserList.push_back(evuser); return NOTERROR; } else return FULLROOM; }
void CUserView::DelUser(CString strIP) { //查找指定IP的用户项 int nItem=FindUser(strIP); if(-1==nItem) return; //删除用户 CListCtrl &theCtrl=GetListCtrl(); theCtrl.DeleteItem(nItem); }
/////////////////////////////////////////////////////////////////////// // Constructor: CEvPasswd // // Author: $author$ // Date: 7/23/2009 /////////////////////////////////////////////////////////////////////// CEvPasswd (const char* chars=0, LONG length=-1) : m_uid(INVALID_UID), m_gid(INVALID_GID) { EvError error; if (chars) if ((error = FindUser(chars, length))) throw(error); }
int COmokRoom::OutUser(EventSocket evuser) { UINT index = 0; EventSocket* temp = FindUser(evuser.sSocket, &index); if(temp != NULL) { this->m_UserList.erase(this->m_UserList.begin() + index); return NOTERROR; } else return EMPTYROOM; }
MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT* psr) { debugLogA("CVkProto::AddToList"); int uid = _ttoi(psr->id.t); if (!uid) return NULL; MCONTACT hContact = FindUser(uid, true); RetrieveUserInfo(uid); return hContact; }
void IRCChannel::SendMsg(string m) { IRCLine l("PRIVMSG",m); l.params.push_back(name); client.SendIRCLine(l); MessageEventArg arg; arg.user = FindUser(client.GetNick()); arg.channel = this; arg.message = m; msgEvent.Notify(arg); }
int main(){ //Kamus Lokal int Y; int i,j; int input; List tes; InfoUser X,Z; adrUser usr; //Algoritma /* Load(&tes); usr=FirstUser(tes); for(i=1;i<10;i++)PrintUser(usr,i); usr=NextUser(usr); for(i=1;i<10;i++)PrintUser(usr,i); */ CreateList(&tes); printf("List Kosong : %d\n",IsListEmpty (tes)); printf("Masukkan nama user \n"); scanf("%s",&X.usr); printf("%s\n", X.usr); InsVUser(&tes,X); scanf("%s",&Z.usr); InsVUser(&tes,Z); usr = FindUser(&tes,X); printf("%x\n",usr); j=-1; for (i=0;i<10;i++){ j=j*-1; InsVScore(usr,j*i*100000,0); InsVScore(usr,j*i*j*100000,1); InsVScore(usr,j*i*i*100000,2); InsVScore(usr,j*i*100000,3); InsVScore(usr,j*i*100000,4); InsVScore(usr,j*i*100000,5); InsVScore(usr,j*i*100000,6); InsVScore(usr,j*i*100000,7); } PrintUser(usr,0); usr=NextUser(usr); for (i=10;i>=0;i--){ j=j*-1; InsVScore(usr,j*i*100000,0); InsVScore(usr,j*i*j*100000,1); } PrintUser(usr,0); Save(tes); return 0; }
std::tuple<ERROR_CODE, User*> UserManager::GetUser(const int sessionIndex) { auto pUser = FindUser(sessionIndex); if (pUser == nullptr) { return{ std::tuple<ERROR_CODE, User*> {ERROR_CODE::USER_MGR_INVALID_SESSION_INDEX, nullptr} }; } if (pUser->IsConfirm() == false) { return{ std::tuple<ERROR_CODE, User*>{ERROR_CODE::USER_MGR_NOT_CONFIRM_USER, nullptr} }; } return{ std::tuple<ERROR_CODE, User*>{ERROR_CODE::NONE, pUser} }; }
BOOL CUserMgr::CreateUser(UINT32 dwUserID, UINT8 byAuthType, UINT8 byAuthMethod, UINT32 dwPlayerID, UINT16 wCareerID, TCHAR* pszUserName, TCHAR* pszPasswd, TCHAR* pszDeviceID, TCHAR* pszNotifyID, TCHAR *pszZoneName, UINT16 wZoneID, UINT32 dwCliVer) { CSDMutexLock lock(m_oMutex); CUser* poUser = FindUser(dwPlayerID); if(poUser) { poUser->SetUserProp(dwUserID, dwPlayerID, byAuthType, byAuthMethod, pszUserName, pszPasswd, pszDeviceID, pszNotifyID, pszZoneName, wCareerID, wZoneID, dwCliVer); return TRUE; } poUser = m_oUserPool.Alloc(); poUser->SetUserProp(dwUserID, dwPlayerID, byAuthType, byAuthMethod, pszUserName, pszPasswd, pszDeviceID, pszNotifyID, pszZoneName, wCareerID, wZoneID, dwCliVer); m_mapPlayerID2User[dwPlayerID] = poUser; return TRUE; }
/** Forwards a numeric message from a remote server. * @param numeric Value of numeric message. * @param nnn If non-zero, treat parv[1] as a numnick; else as a client name. * @param cptr Client that originated the numeric. * @param sptr Peer that sent us the numeric. * @param parc Count of valid arguments in \a parv. * @param parv Argument list. * @return Zero (always). */ int do_numeric(int numeric, int nnn, struct Client *cptr, struct Client *sptr, int parc, char *parv[]) { struct Client *acptr = 0; struct Channel *achptr = 0; char num[4]; /* Avoid trash, we need it to come from a server and have a target */ if ((parc < 2) || !IsServer(sptr)) return 0; /* Who should receive this message ? Will we do something with it ? Note that we use findUser functions, so the target can't be neither a server, nor a channel (?) nor a list of targets (?) .. u2.10 should never generate numeric replies to non-users anyway Ahem... it can be a channel actually, csc bots use it :\ --Nem */ if (IsChannelName(parv[1])) achptr = FindChannel(parv[1]); else acptr = (nnn) ? (findNUser(parv[1])) : (FindUser(parv[1])); if (((!acptr) || (cli_from(acptr) == cptr)) && !achptr) return 0; /* Remap low number numerics, not that I understand WHY.. --Nemesi */ /* numerics below 100 talk about the current 'connection', you're not * connected to a remote server so it doesn't make sense to send them * remotely - but the information they contain may be useful, so we * remap them up. Weird, but true. -- Isomer */ if (numeric < 100) numeric += 100; ircd_snprintf(0, num, sizeof(num), "%03d", numeric); /* Since 2.10.10.pl14 we rewrite numerics from remote servers to appear to * come from the local server */ if (acptr) sendcmdto_one((feature_bool(FEAT_HIS_REWRITE) && !IsOper(acptr)) ? &me : sptr, num, num, acptr, "%C %s", acptr, parv[2]); else sendcmdto_channel_butone(feature_bool(FEAT_HIS_REWRITE) ? &me : sptr, num, num, achptr, cptr, SKIP_DEAF | SKIP_BURST, '\0', "%H %s", achptr, parv[2]); return 0; }
int RoomMng::RemoveUser(int id) { UserClient* user = FindUser(id); if (!user){ return 0; } UserRoom* ur = FindRoom(user->roomid()); if (!ur){// finded user, so couldn't finded user room delete user; return -1; } ur->RemoveClient(user); delete user; // TODO: remove room when user is empty; return 0; }
LoginView::LoginView(Rect cRect,Window* pcParent) : View(cRect,"login_view") { pcParentWindow = pcParent; Layout(); String cName = GetHighlightName(); if (cName != "") { FindUser(cName); } pcParentWindow->SetFocusChild(pcPassText); pcParentWindow->SetDefaultButton(pcLoginButton); SetTabOrder( NO_TAB_ORDER ); }
/* * m_pseudo - generic service message handler * * parv[0] = sender prefix * parv[1] = service mapping (s_map * disguised as char *) * parv[2] = message */ int m_pseudo(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { char *text, buffer[BUFSIZE]; struct s_map *map; struct nick_host *nh; assert(0 != cptr); assert(cptr == sptr); assert(0 != cli_user(sptr)); /* By default, relay the message straight through. */ text = parv[parc - 1]; /* HACK! HACK! HACK! HACK! Yes. It's icky, but * it's the only way. */ map = (struct s_map *)parv[1]; assert(0 != map); if (parc < 3 || EmptyString(text)) { if (map->defaulttext) text = map->defaulttext; else return send_reply(sptr, ERR_NOTEXTTOSEND); } if (map->prepend) { ircd_snprintf(0, buffer, sizeof(buffer) - 1, "%s%s", map->prepend, text); buffer[sizeof(buffer) - 1] = 0; text = buffer; } for (nh = map->services; nh; nh = nh->next) { struct Client *target, *server; if (NULL == (server = FindServer(nh->nick + nh->nicklen + 1))) continue; nh->nick[nh->nicklen] = '\0'; if ((NULL == (target = FindUser(nh->nick))) || (server != cli_user(target)->server)) continue; nh->nick[nh->nicklen] = '@'; relay_directed_message(sptr, nh->nick, nh->nick + nh->nicklen, text); return 0; } return send_reply(sptr, ERR_SERVICESDOWN, map->name); }
void relay_directed_notice(struct Client* sptr, char* name, char* server, const char* text) { struct Client* acptr; char* host; assert(0 != sptr); assert(0 != name); assert(0 != text); assert(0 != server); if (0 == (acptr = FindServer(server + 1))) return; /* * NICK[%host]@server addressed? See if <server> is me first */ if (!IsMe(acptr)) { sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text); return; } /* * Look for an user whose NICK is equal to <name> and then * check if it's hostname matches <host> and if it's a local * user. */ *server = '\0'; if ((host = strchr(name, '%'))) *host++ = '\0'; if (!(acptr = FindUser(name)) || !MyUser(acptr) || (!EmptyString(host) && 0 != match(host, cli_user(acptr)->realhost))) return; *server = '@'; if (host) *--host = '%'; if (!IsChannelService(sptr) && is_silenced(sptr, acptr)) { send_reply(sptr, ERR_SILENCED, cli_name(acptr)); return; } if (IsOnlyreg(acptr) && !IsRegnick(sptr)) send_reply(sptr, RPL_MSGONLYREG, cli_name(acptr)); else sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text); }
ERROR_CODE Lobby::LeaveUser(const int userIndex) { RemoveUser(userIndex); auto pUser = FindUser(userIndex); if (pUser == nullptr) { return ERROR_CODE::LOBBY_LEAVE_USER_NVALID_UNIQUEINDEX; } pUser->LeaveLobby(); m_UserIndexDic.erase(pUser->GetIndex()); m_UserIDDic.erase(pUser->GetID().c_str()); return ERROR_CODE::NONE; }