Esempio n. 1
0
DlgAuth::DlgAuth(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DlgAuth)
{
    ui->setupUi(this);

    setWindowTitle(QApplication::applicationName() + tr(" - Авторизация"));

    connect(ui->btnAuth,SIGNAL(clicked()),SLOT(OnAuth()));
    connect(ui->btnSetting, SIGNAL(clicked()),SLOT(openDlgSettingConnect()));


}
Esempio n. 2
0
void GameSocket::ProcessData(unsigned char* data, int size)
{
    Reader.SetBuffer(data);

    int offset = 0;
    while(offset < size)
    {
        unsigned short psize  = Reader.ReadWord() + 6;
        unsigned short opcode = Reader.ReadWord();
        Reader.Skip(2);

        switch(opcode) {

        case GAME_CLIENT_KEEP_ALIVE:
        case GAME_CLIENT_ACCEPT_HANDSHAKE:
            break;

        case GAME_CLIENT_INFO:
            SendServerInfo();
            break;

        case GAME_CLIENT_PATCH_REQUEST:
            SendPatchInfo();
            break;

        case GAME_CLIENT_AUTH:
            OnAuth();
            break;

        case GAME_CLIENT_CHARACTER:
            OnCharacter();
            break;

        case GAME_CLIENT_INGAME_REQUEST:
            OnIngameRequest();
            break;

        case GAME_CLIENT_MOVEMENT:
            OnMovement();
            break;

        case GAME_CLIENT_CLOSE:
            OnGameQuit();
            break;

        case GAME_CLIENT_CHAT:
            OnChat();
            break;

        case GAME_CLIENT_ITEM_MOVE:
            OnItem();
            break;

        case GAME_CLIENT_TARGET:
            OnTarget();
            break;

        case GAME_CLIENT_INGAME_NOTIFY:
            OnIngameNotify();
            break;

        case GAME_CLIENT_EMOTION://update carlosx
            OnEmotion();
            break;

        case GAME_CLIENT_SIT: //update carlosx
            OnSit();
            break;

        case GAME_CLIENT_ESTRELLA: //update carlosx
            OnEstrella();
            break;

        case GAME_CLIENT_ADDSKILL: //update carlosx
            OnUpdateSkill();
            break;

        case GAME_CLIENT_MASTERY: //update carlosx
            OnMastertSkill();
            break;

        case GAME_CLIENT_ATSKILL: //update carlosx
            OnATSkill();
            break;

        case GAME_CLIENT_ADDSTR:  //update carlosx
            OnADDStr();
            break;

        case GAME_CLIENT_ADDINT:  //update carlosx
            OnADDInt();
            break;

        case GAME_CLIENT_GM:
            OnGM();
            break;

        default:
            printf("Unknown opcode: %.4x\n", opcode);
        }
        Reader.Reset();
        Reader.Skip(psize);
        offset += psize;
    }
    Reader.Reset();
}
Esempio n. 3
0
void IrcClient::OnLine(RCString line) {
	smatch m;
	string sline = explicit_cast<string>(line);
	if (regex_search(sline, m, s_reMessage)) {
		String prefix = m[1];
		String c = m[3];
		String reply = m[2];
		string pars = m[4];
		vector<String> params;
		for (regex_iterator<string::const_iterator> it(pars.begin(), pars.end(), s_reParams), e; it!=e; ++it) {
			params.push_back((*it)[1].matched ? (*it)[1] : (*it)[2]);
		}
		if (!reply.empty()) {
			int nReply = atoi(reply);
			switch (nReply) {

			case RPL_CREATED:
				SendPendingData();
				ConnectionEstablished = true;
				OnCreatedConnection();
				break;
			case RPL_USERHOST:
				{
					smatch m;
					if (regex_search(pars, m, s_reUserhost)) {
						String host = m[1];
						OnUserHost(host);
					}
				}
				break;
			case RPL_WHOREPLY:
				if (params.size() > 7) {
					String channel = params.at(1).substr(1);
					String realname = params.at(7).Split("", 2).at(1).Trim();
					IrcUserInfo info = { params.at(2), params.at(3), params.at(4), params.at(5), realname };
					m_whoLists[channel].push_back(info);
				}
				break;
			case RPL_NAMREPLY: 
				{
					String channel = params.at(2).substr(1);
					vector<String> nicks = params.at(3).Split();
					m_nameList[channel].insert(nicks.begin(), nicks.end());
				}
				break;
			case RPL_ENDOFNAMES:
				{
					String channel = params.at(1).substr(1);
					OnNickNamesComplete(channel, m_nameList[channel]);
				}
				break;
			case RPL_ENDOFWHO:
				{
					String channel = params.at(1).substr(1);
					CWhoList::iterator it = m_whoLists.find(channel);
					if (it != m_whoLists.end()) {
						vector<IrcUserInfo> vec = it->second;
						m_whoLists.erase(it);
						OnUserListComplete(channel, vec);
					}
				}
				break;
			}
		} else if (!c.empty()) {
			if (c == "NOTICE") {
				if (params.size() > 0) {
					if (params[0] == "AUTH") {
						OnAuth();
					}
				}
			} else if (c == "PING") {
				String s1 = params.at(0), s2;
				if (params.size() >= 2)
					s2 = params.at(1);
				OnPing(s1, s2);
			}
		}
	} else
		Throw(E_FAIL);
}