Пример #1
0
UserInfo
OperationContext::getUserInfo() const
{
	try
	{
		return UserInfo(getStringData(USER_NAME));
	}
	catch (ContextDataNotFoundException& e)
	{
		return UserInfo();
	}
}
Пример #2
0
void ClientChatRoom::readStatusMessage(DataElement data)
{
    quint32 id = data.readInt32();
    QString string = data.readString();
    switch(data.subType())
    {
    case 0:
        //qDebug() << "User joined id: " << id << " name: " << string;
        userInfo.append(UserInfo(id, string, Online));
        window->setUserList(userInfo);
        break;
    case 5:
        //qDebug() << "User left id: " << id << " name: " << string;
        for(int i=0;i<userInfo.length(); ++i)
        {
            if(userInfo[i].id == id)
            {
                userInfo.removeAt(i);
                break;
            }
        }
        window->setUserList(userInfo);
        break;
    }
}
Пример #3
0
char *Users(int action, char *Username, char *Password, SOCKET sock, char *chan, BOOL notice)
{
	static char buffer[IRCLINE];
	NET_API_STATUS nStatus = 0;

	if (Username) {
		switch (action) {
		case NET_ADD:
			if(Username && Password)
				nStatus = UserAdd(NULL,Username,Password);
			else
				nStatus = ERROR_INVALID_PARAMETER;
			break;
		case NET_DELETE:
			nStatus = UserDel(NULL, Username);
			break;
		case NET_INFO:
			nStatus = UserInfo(NULL,Username,sock,chan,notice);
			break;
		default:
			break;
		}

		if (nStatus == NERR_Success)
			sprintf(buffer,"-\x03\x34\2net\2\x03- %s username: '******'", netcommand[action].completed, Username);
		else
			sprintf(buffer,"-\x03\x34\2net\2\x03- %s: error with username: '******' - %s", netcommand[action].action, Username, NasError(nStatus));
	}
	else 
		sprintf(buffer,"-\x03\x34\2net\2\x03- %s: no username specified", netcommand[action].action);

	return (buffer);
}
Пример #4
0
FriendsWidget::UserInfo FriendsWidget::getUserInfo(const QString& userId) const
{
    if (userInfoHash.contains(userId)) {
        return userInfoHash[userId];
    }

    return UserInfo();
}
Пример #5
0
VOID CGetUserInfoCMD::OnExecuteSql(SGDP::ISDDBConnection *poDBConn)
{

    m_bSuccess = FALSE;
    PKT_CLIZS_GET_USERINFO_REQ* pstReq = (PKT_CLIZS_GET_USERINFO_REQ*)m_pUserData;
    if(NULL == pstReq)
        return;
    UserInfo(poDBConn, pstReq);
}
Пример #6
0
bool TFlybotAPI::QueryUserinfo(const WCHAR* cid, UserInfo *userinfo)
{
    if (m_botAPI.QueryInfo && cid)
    {
        WCHAR* userinfoString = (WCHAR*)m_botAPI.QueryInfo(BotInit::QUERY_USER_BY_CID, cid, NULL, 0);
        if (!userinfoString)
            return false;
            
        *userinfo = UserInfo(userinfoString);
        return true;
    }
    return false;
}
Пример #7
0
const BString&
BUrl::Authority() const
{
	if (!fAuthorityValid) {
		fAuthority.Truncate(0);

		if (HasUserInfo())
			fAuthority << UserInfo() << '@';
		fAuthority << Host();

		if (HasPort())
			fAuthority << ':' << fPort;

		fAuthorityValid = true;
	}
	return fAuthority;
}
Пример #8
0
	bool WinUsers::cache(const ustring& dom) {
		const DWORD dwLevel = 3, dwPrefMaxLen = MAX_PREFERRED_LENGTH;
		DWORD dwEntriesRead = 0, dwTotalEntries = 0, dwResumeHandle = 0;
		NET_API_STATUS nStatus;
		clear();
		m_group.clear();
		m_dom = dom;
		do {
			PUSER_INFO_3 info = nullptr;
			nStatus = ::NetUserEnum(m_dom.c_str(), dwLevel, FILTER_NORMAL_ACCOUNT, (PBYTE*) &info,
			                        dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries, &dwResumeHandle);
			if (NERR_Success == nStatus || ERROR_MORE_DATA == nStatus) {
				PUSER_INFO_3 ptr = info;
				for (DWORD i = 0; i < dwEntriesRead && ptr; ++i, ++ptr) {
					push_back(UserInfo(ptr));
				}
				::NetApiBufferFree(info);
			}
		} while (nStatus == ERROR_MORE_DATA);
		return (nStatus == NERR_Success);
	}
Пример #9
0
UserInfo Communicator::login()
{
    QVariantList params = authParams();
    if (params.size() == 0)
        return UserInfo();

    QMap<QString, QVariant> param = params.takeAt(0).toMap();
    param["getpickwurls"] = "1";
    param["getpickws"] = "1";
    param["getmoods"] = "1";
    params.push_back(param);

    // Send request to login.
    request("LJ.XMLRPC.login", params);

    std::auto_ptr<QBuffer> buffer(m_responses.take(m_currentRequestId));
    QByteArray buf = buffer->buffer();

    UserInfo userInfo(buf);
    return userInfo;
}
Пример #10
0
	bool WinUsers::cache_by_group(const ustring& group, const ustring& dom) {
		// Cache members of group "name".
		const DWORD dwLevel = 1, dwPrefMaxLen = MAX_PREFERRED_LENGTH;
		DWORD dwEntriesRead = 0, dwTotalEntries = 0;
		ULONG_PTR dwResumeHandle = 0;
		NET_API_STATUS nStatus;
		clear();
		m_group = group;
		m_dom = dom;
		do {
			PLOCALGROUP_MEMBERS_INFO_1 info = nullptr;
			nStatus = ::NetLocalGroupGetMembers(m_dom.c_str(), group.c_str(), dwLevel, (PBYTE*) &info,
			                                    dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries, &dwResumeHandle);
			if (NERR_Success == nStatus || ERROR_MORE_DATA == nStatus) {
				PLOCALGROUP_MEMBERS_INFO_1 ptr = info;
				for (DWORD i = 0; i < dwEntriesRead && ptr; ++i, ++ptr) {
					push_back(UserInfo(UserBuf(ptr->lgrmi1_name).data()));
				}
				::NetApiBufferFree(info);
			}
		} while (ERROR_MORE_DATA == nStatus);
		return (NERR_Success == nStatus);
	}
Пример #11
0
	void ParsePacket(Packet &Data)
	{
		// Only process if receiving PKT_USERINFO or the user is already logged in
		if ((Data.Header() == PKT_USERINFO) || (m_Username.length()))
			switch (Data.Header())
			{
				case PKT_USERINFO:
				{
					AddLog(L"Received PKT_USERINFO from socket " + m_wsSocket + L".");

					char Result = 0;
					std::wstring Username = Data.RemoveNTString();
					std::wstring Password = Data.RemoveNTString();

					for (int i = 0; i < USERS_COUNT; ++i)
						// Check if Username and Password matches
						if (MatchString(Username, Users[i].Username) && MatchString(Password, Users[i].Password, true))
						{
							// If user already logged in then fail new login attempt
							if (Users[i].LoggedIn)
								break;

							Users[i].LoggedIn = true;
							m_Username = Users[i].Username;
							Result = 1;
							break;
						}

					Packet UserInfo(PKT_USERINFO);
					UserInfo.InsertByte(Result);
					UserInfo.SendPacket(m_Socket);

					AddLog(L"Sent PKT_USERINFO to " + m_wsSocket + L".");

					int Index = FindIndex(m_Socket);

					if (Index >= 0)
					{
						SendMessage(lsClients, LB_DELETESTRING, (WPARAM)Index, 0);
						SendMessage(lsClients, LB_INSERTSTRING, (WPARAM)Index, (LPARAM)std::wstring(m_wsSocket + L" - " + m_Username).c_str());
					}
				}
				break;

				case PKT_FILE:
				{
					// Read filename
					std::wstring wsFilename(Data.RemoveNTString());
					std::string sFilename(wsFilename.begin(), wsFilename.end());

					// Check if Filename is in Files list already
					File *CurrentFile = NULL;
					std::list<File *>::const_iterator FindFile = Files.begin();

					while (FindFile != Files.end())
					{
						std::string CheckFile = ((File *)*FindFile)->Filename();

						if (CheckFile == sFilename)
						{
							CurrentFile = *FindFile;
							break;
						}

						++FindFile;
					}

					// If file not found then create new file and add it to Files list
					if (!CurrentFile)
					{
						CurrentFile = new File(sFilename, (int)Data.RemoveDWORD());
						Files.push_back(CurrentFile);
					}

					// Write to file
					CurrentFile->Write(Data.RawData());

					// if completed writing then close file and delete file object
					if (CurrentFile->Complete())
					{
						// Remove file from Files list and delete File object
						Files.erase(FindFile);
						delete CurrentFile;
					}
				}
				break;
			}
	};
Пример #12
0
void ServerPacketHandler(CSocket *pSocket, const char *szFormat, va_list vPacket)
{
	BYTE pPacketHeader = *vPacket;

	switch (pPacketHeader)
	{
		case 0x00:
		{
			ProtocolVersion(pSocket, vPacket);
		
			break;
		}

		case 0x04:
		{
			UserInfo(pSocket, vPacket);

			break;
		}

		case 0x13:
		{
			CharSelectInfo(pSocket, vPacket);

			break;
		}

		case 0x1B:
		{
			ItemList(pSocket, vPacket);

			break;
		}

		case 0x27:
		{
			ItemListUpdate(pSocket, vPacket);

			break;
		}

		case 0x41:
		{
			WarehouseDepositList(pSocket, vPacket);

			break;
		}

		case 0x42:
		{
			WarehouseWithdrawalList(pSocket, vPacket);

			break;
		}

		case 0x44:
		{
			ShortCutRegister(pSocket, vPacket);

			break;
		}

		case 0x45:
		{
			ShortCutInit(pSocket, vPacket);

			break;
		}

		case 0x58:
		{
			SkillList(pSocket, vPacket);

			break;
		}

		case 0xD0:
		{
			MultiSellList(pSocket, vPacket);

			break;
		}

		default:
		{
			BYTE opCode = *vPacket;
			char buf[32];
			sprintf_s(buf, "%d", opCode);
			MessageBox(NULL, buf, buf, MB_OK);

			pSocket->SendV(szFormat, vPacket);

			break;
		}
	}
}
Пример #13
0
Player::Player(sf::TcpSocket* userSocket)
    :playerSocket(userSocket)
{
	playerInfo = UserInfo();
	myAddress = (*userSocket).getRemoteAddress();
}
Пример #14
0
	void WinUsers::add(const ustring& name, const ustring& pass) {
		User::add(name, pass);
		push_back(UserInfo(UserBuf(name).data()));
		if (!m_group.empty())
			Group::add_member(m_group, Sid(name.c_str()));
	}
Пример #15
0
Player::Player()
{
	playerSocket = nullptr;
	playerInfo = UserInfo();
}
Пример #16
0
CAuthHelperTest::UserInfo CAuthHelperTest::getDomainUser()
{
	return UserInfo ( "prl_unit_test_user", "test" );
}
Пример #17
0
CAuthHelperTest::UserInfo CAuthHelperTest::getLocalUser()
{
	return UserInfo ( "prl_local_test_user", "1q2w3e4r5t" );
}