コード例 #1
0
bool IRCSession::handleResponse(const std::string &command)
{
	IRCParser parser;
	shared_ptr<IIRCCommand> response = parser.parse(get_this_ptr(), command);
	if(response != nullptr)
	{
		processResponse(response);
		notifyCommand(response);

	    shared_ptr<IIRCCommand> reply = response->getReply();
		if(reply != nullptr)
			addRequest(reply, false);
	}
	else
	{
		OS_LOG_DEBUG(_S("Unknown IRC command '") + command + _S("'"));
	}

	return parser.getAlive();
}
コード例 #2
0
ファイル: Facade.cpp プロジェクト: 178435865/game
void Facade::sendCommand(const string& name,void* data)
{
	Notification noti(name,data,NOTIFIER_ALL);
	notifyCommand(noti);
}
コード例 #3
0
ファイル: hook.cpp プロジェクト: byplayer/yamy
/// hook of SendMessage
LRESULT CALLBACK callWndProc(int i_nCode, WPARAM i_wParam, LPARAM i_lParam)
{
    if (!g.m_isInitialized)
        initialize(false);

    if (!g_hookData)
        return 0;

    CWPSTRUCT &cwps = *(CWPSTRUCT *)i_lParam;

    if (0 <= i_nCode) {
        switch (cwps.message) {
        case WM_ACTIVATEAPP:
        case WM_NCACTIVATE:
            if (i_wParam)
                notifySetFocus();
            break;
        case WM_SYSCOMMAND:
            switch (cwps.wParam) {
            case SC_MAXIMIZE:
            case SC_MAXIMIZE2:
                updateShow(cwps.hwnd, NotifyShow::Show_Maximized);
                break;
            case SC_MINIMIZE:
            case SC_MINIMIZE2:
                updateShow(cwps.hwnd, NotifyShow::Show_Minimized);
                break;
            case SC_RESTORE:
            case SC_RESTORE2:
                updateShow(cwps.hwnd, NotifyShow::Show_Normal);
                break;
            default:
                break;
            }
        /* through below */
        case WM_COMMAND:
            notifyCommand(cwps.hwnd, cwps.message, cwps.wParam, cwps.lParam);
            break;
        case WM_SIZE:
            switch (cwps.wParam) {
            case SIZE_MAXIMIZED:
                updateShow(cwps.hwnd, NotifyShow::Show_Maximized);
                break;
            case SIZE_MINIMIZED:
                updateShow(cwps.hwnd, NotifyShow::Show_Minimized);
                break;
            case SIZE_RESTORED:
                updateShow(cwps.hwnd, NotifyShow::Show_Normal);
                break;
            default:
                break;
            }
            break;
        case WM_MOUSEACTIVATE:
            notifySetFocus();
            break;
        case WM_ACTIVATE:
            if (LOWORD(cwps.wParam) != WA_INACTIVE) {
                notifySetFocus();
                if (HIWORD(cwps.wParam)) { // check minimized flag
                    // minimized flag on
                    notifyShow(NotifyShow::Show_Minimized, false);
                    //notifyShow(NotifyShow::Show_Normal, true);
                }
            }
            break;
        case WM_ENTERMENULOOP:
            g.m_isInMenu = true;
            notifySetFocus(true);
            break;
        case WM_EXITMENULOOP:
            g.m_isInMenu = false;
            notifySetFocus(true);
            break;
        case WM_SETFOCUS:
            g.m_isInMenu = false;
            // for kana
            if (g_hookData->m_correctKanaLockHandling) {
                if (HIMC hIMC = ImmGetContext(cwps.hwnd)) {
                    bool status = !!ImmGetOpenStatus(hIMC);
                    // this code set the VK_KANA state correctly.
                    ImmSetOpenStatus(hIMC, !status);
                    ImmSetOpenStatus(hIMC, status);
                    ImmReleaseContext(cwps.hwnd, hIMC);
                }
            }
            notifySetFocus();
            notifyLockState(5);
            break;
        case WM_IME_STARTCOMPOSITION:
            g.m_isImeCompositioning = true;
            notifyLockState(6);
            break;
        case WM_IME_ENDCOMPOSITION:
            g.m_isImeCompositioning = false;
            notifyLockState(7);
            break;
        case WM_IME_NOTIFY:
            if (cwps.wParam == IMN_SETOPENSTATUS)
                if (HIMC hIMC = ImmGetContext(cwps.hwnd)) {
                    g.m_isImeLock = !!ImmGetOpenStatus(hIMC);
                    ImmReleaseContext(cwps.hwnd, hIMC);
                    notifyLockState(8);
                }
            break;
        }
    }
    return CallNextHookEx(s_hookDataArch->m_hHookCallWndProc, i_nCode,
                          i_wParam, i_lParam);
}
コード例 #4
0
ファイル: hook.cpp プロジェクト: byplayer/yamy
/// hook of GetMessage
LRESULT CALLBACK getMessageProc(int i_nCode, WPARAM i_wParam, LPARAM i_lParam)
{
    if (!g.m_isInitialized)
        initialize(false);

    if (!g_hookData)
        return 0;

    MSG &msg = (*(MSG *)i_lParam);

    if (i_wParam != PM_REMOVE)
        goto finally;

    switch (msg.message) {
    case WM_COMMAND:
    case WM_SYSCOMMAND:
        notifyCommand(msg.hwnd, msg.message, msg.wParam, msg.lParam);
        break;
    case WM_KEYDOWN:
    case WM_KEYUP:
    case WM_SYSKEYDOWN:
    case WM_SYSKEYUP: {
        if (HIMC hIMC = ImmGetContext(msg.hwnd)) {
            bool prev = g.m_isImeLock;
            g.m_isImeLock = !!ImmGetOpenStatus(hIMC);
            ImmReleaseContext(msg.hwnd, hIMC);
            if (prev != g.m_isImeLock) {
                notifyLockState(1);
            }
        }
        int nVirtKey = (int)msg.wParam;
        // int repeatCount = (msg.lParam & 0xffff);
        BYTE scanCode   = (BYTE)((msg.lParam >> 16) & 0xff);
        bool isExtended = !!(msg.lParam & (1 << 24));
        // bool isAltDown  = !!(msg.lParam & (1 << 29));
        // bool isKeyup    = !!(msg.lParam & (1 << 31));

        if (nVirtKey == VK_CAPITAL ||
                nVirtKey == VK_NUMLOCK ||
                nVirtKey == VK_KANA ||
                nVirtKey == VK_SCROLL)
            notifyLockState(2);
        else if (scanCode == g_hookData->m_syncKey &&
                 isExtended == g_hookData->m_syncKeyIsExtended)
            notifySync();
        break;
    }
    case WM_IME_STARTCOMPOSITION:
        g.m_isImeCompositioning = true;
        notifyLockState(3);
        break;
    case WM_IME_ENDCOMPOSITION:
        g.m_isImeCompositioning = false;
        notifyLockState(4);
        break;
    default:
        if (i_wParam == PM_REMOVE && msg.message == g.m_WM_MAYU_MESSAGE) {
            switch (msg.wParam) {
            case MayuMessage_notifyName:
                notifyName(msg.hwnd);
                break;
            case MayuMessage_funcRecenter:
                funcRecenter(msg.hwnd);
                break;
            case MayuMessage_funcSetImeStatus:
                funcSetImeStatus(msg.hwnd, msg.lParam);
                break;
            case MayuMessage_funcSetImeString:
                funcSetImeString(msg.hwnd, msg.lParam);
                break;
            }
        }
        break;
    }
finally:
    return CallNextHookEx(s_hookDataArch->m_hHookGetMessage,
                          i_nCode, i_wParam, i_lParam);
}