Exemple #1
0
unsigned int GMsgBox::process_command (GMessage& msg)
{

	switch(msg.param)
	{
	case ID_MB_TEXT_BOX:
		if(type &(MBF_LAST_BTN-1))
			break;
		notify_message(WM_CLOSE, GO_IDOK, this);								//closes the window
		return 1;

	case GO_IDYES:
		notify_message(WM_CLOSE, GO_IDYES, this);								//closes the window
		return 1;
	case GO_IDNO:
		notify_message(WM_CLOSE, GO_IDNO, this);							//closes the window
		return 1;
	case GO_IDRETRY:
		notify_message(WM_CLOSE, GO_IDRETRY, this);							//closes the window
		return 1;
	default:
		return GDialog::process_command(msg);
	}
	return 0;
}
static void write_conv(PurpleConversation *conv, const char *who, const char *alias,
			const char *message, PurpleMessageFlags flags, time_t mtime)
{	
  if (im_handler != Qnil) {
    PurpleAccount* account = purple_conversation_get_account(conv);
    if (strcmp(purple_account_get_protocol_id(account), "prpl-msn") == 0 &&
         (strstr(message, "Message could not be sent") != NULL ||
          strstr(message, "Message was not sent") != NULL ||
          strstr(message, "Message may have not been sent") != NULL
         )
        ) {
      /* I have seen error like 'msn: Connection error from Switchboard server'.
       * In that case, libpurple will notify user with two regular im message.
       * The first message is an error message, the second one is the original message that failed to send.
       */
      notify_message(PURPLE_CONNECTION_ERROR_NETWORK_ERROR, message, purple_account_get_protocol_id(account), who);
    } else {
      VALUE args[3];
      args[0] = Data_Wrap_Struct(cAccount, NULL, NULL, account);
      args[1] = rb_str_new2(who);
      args[2] = rb_str_new2(message);
      check_callback(im_handler, "im_handler");
      rb_funcall2(im_handler, CALL, 3, args);
    }
  }
}
Exemple #3
0
unsigned int GWindow::process_destroy(GMessage& msg)
{
	close();
	flags &= ~ (GO_FLG_SHOW|GO_FLG_ENABLED|GO_FLG_SELECTED); // hide and disable this window
	if(parent && parent->focus)
	{
		GWindow* tmp = (GWindow *)parent->children;
		while(tmp)
		{
			if(tmp->flags & GO_FLG_SHOW)
			{
#if GUI_DISPLAYS > 1
				if(tmp->displays & displays)
				{
					unsigned int backup = tmp->displays;
					tmp->displays = displays;
					tmp->invalidate(this, rect.as_int); //updating only the display from which this window is visible
					tmp->displays = backup;
				}
#else
				tmp->invalidate(this, rect.as_int); //updating only the display from which this window is visible
#endif
			}
			tmp = (GWindow *)tmp->nextObj;
		}
	}
	notify_message(WM_QUIT, msg.param);
	return true;
}
Exemple #4
0
HRESULT STDMETHODCALLTYPE CGainer::ReadVersion( 
            /* [retval][out] */ BSTR *pResult)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    if (!pResult) return E_POINTER;
    notify_message(m_iothread_id, WM_COM_IO, "?*");
    return wait_response(pResult);
}
void sipe_backend_notify_message_info(struct sipe_core_public *sipe_public,
				      struct sipe_backend_chat_session *backend_session,
				      const gchar *who,
				      const gchar *message)
{
	notify_message(sipe_public, PURPLE_MESSAGE_SYSTEM,
		       backend_session, who, message);
}
Exemple #6
0
HRESULT STDMETHODCALLTYPE CGainer::put_Verbose( 
            /* [in] */ VARIANT_BOOL Enabled)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    char vmode[16];
    sprintf(vmode, "V%d*", (Enabled) ? 1 : 0);
    notify_message(m_iothread_id, WM_COM_IO, vmode);
    return S_OK;
}
Exemple #7
0
HRESULT STDMETHODCALLTYPE CGainer::put_LED( 
            /* [in] */ VARIANT_BOOL On)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    char cled[16];
    sprintf(cled, "%c*", (On) ? 'h' : 'l');
    notify_message(m_iothread_id, WM_COM_IO, cled);
    return S_OK;
}
Exemple #8
0
HRESULT STDMETHODCALLTYPE CGainer::Close( void)
{
    if (m_iothread)
    {
        notify_message(m_iothread_id, WM_COM_CLOSE);
        FinalRelease();
    }
    return S_OK;
}
Exemple #9
0
HRESULT STDMETHODCALLTYPE CGainer::put_Configuration( 
            /* [in] */ GainerConfiguration mode)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    if (mode < INIT_MODE || mode > CAPACITIVE_SENSING_MODE) return Error(IDS_E_PARAM);
    char smode[32];
    sprintf(smode, "KONFIGURATION_%d*", mode);
    notify_message(m_iothread_id, WM_COM_IO, smode);
    return S_OK;
}
Exemple #10
0
HRESULT STDMETHODCALLTYPE CGainer::put_AinSamplingMode( 
            /* [in] */ long NewMode)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    if (NewMode < 0 || NewMode > 1) return Error(IDS_E_PARAM);

    char smode[16];
    sprintf(smode, "M%d*", NewMode);
    notify_message(m_iothread_id, WM_COM_IO, smode);
    return S_OK;
}
Exemple #11
0
HRESULT STDMETHODCALLTYPE CGainer::WriteDigitalOutput( 
            /* [in] */ long Port,
            /* [in] */ VARIANT_BOOL High)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    CHECK_PORT(Port);
    char msg[8];
    sprintf(msg, "%c%d*", (High) ? 'H' : 'L', Port);
    notify_message(m_iothread_id, WM_COM_IO, msg);
    return S_OK;
}
Exemple #12
0
HRESULT STDMETHODCALLTYPE CGainer::ReadAnalogInput( 
            /* [in] */ long Port,
            /* [retval][out] */ long *pResult)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    CHECK_PORT(Port);
    char msg[8];
    printf(msg, "S%d*", Port);
    notify_message(m_iothread_id, WM_COM_IO, msg);
    return S_OK;
}
Exemple #13
0
HRESULT STDMETHODCALLTYPE CGainer::WriteAnalogOuput( 
            /* [in] */ long Port,
            /* [in] */ long Value)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    CHECK_PORT(Port);
    char msg[8];
    sprintf(msg, "a%d%02X*", Port, Value);
    notify_message(m_iothread_id, WM_COM_IO, msg);
    return S_OK;
}
Exemple #14
0
unsigned int GWindow::process_key (GMessage& msg)
{
	if(focus && focus->message(msg))
		return 1;
	switch (msg.param)
	{
	case KEY_ESC:
		notify_message(WM_CLOSE, GO_EXIT, this);														//closes the window
		return 1;
	default:
		return 0;
	}
}
Exemple #15
0
void
privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDateTime *timestamp)
{
    assert(privatewin != NULL);

    ProfWin *window = (ProfWin*) privatewin;
    int num = wins_get_num(window);

    Jid *jidp = jid_create(privatewin->fulljid);
    if (jidp == NULL) {
        return;
    }

    gboolean is_current = wins_is_current(window);
    gboolean notify = prefs_do_chat_notify(is_current);

    // currently viewing chat window with sender
    if (wins_is_current(window)) {
        win_print_incoming_message(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
        title_bar_set_typing(FALSE);
        status_bar_active(num);

    // not currently viewing chat window with sender
    } else {
        status_bar_new(num);
        cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num, privatewin->unread);
        win_print_incoming_message(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);

        privatewin->unread++;

        if (prefs_get_boolean(PREF_FLASH)) {
            flash();
        }
    }

    if (prefs_get_boolean(PREF_BEEP)) {
        beep();
    }

    if (notify) {
        notify_message(jidp->resourcepart, num, message);
    }

    jid_destroy(jidp);
}
Exemple #16
0
HRESULT STDMETHODCALLTYPE CGainer::ReadAllAnalogInputs( 
            /* [optional][in] */ VARIANT ContinuousMode,
            /* [retval][out] */ SAFEARRAY **ppResult)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);

    bool continuous = convert_default(ContinuousMode);
    notify_message(m_iothread_id, WM_COM_IO, (continuous) ? "i*" : "I*");
    if (continuous)
        return S_OK;
    BSTR bstr;
    HRESULT hr = wait_response(&bstr);
    if (hr == S_OK)
    {
        *ppResult = convert(bstr);
        SysFreeString(bstr);
    }
    return hr;
}
Exemple #17
0
HRESULT STDMETHODCALLTYPE CGainer::WriteAllDigitalOutputs( 
            /* [in] */ SAFEARRAY **NewValue)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    if (!NewValue || !*NewValue) return E_POINTER;
    SAFEARRAY* p = *NewValue;
    SafeArrayLock(p);
    LPBYTE pdata = reinterpret_cast<LPBYTE>(p->pvData);
    char* dst = reinterpret_cast<char*>(_alloca(p->rgsabound[0].cElements + 8));
    char* msg = dst;
    *dst++ = 'D';
    for (size_t i = p->rgsabound[0].lLbound; i < p->rgsabound[0].cElements; i++)
    {
        dst += sprintf(dst, "%d", *(pdata + i - p->rgsabound[0].lLbound));
    }
    *dst++ = '*';
    *dst = '\0';
    SafeArrayUnlock(p);
    notify_message(m_iothread_id, WM_COM_IO, msg);
    return S_OK;
}
Exemple #18
0
void
privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDateTime *timestamp)
{
    assert(privatewin != NULL);

    ProfWin *window = (ProfWin*) privatewin;
    int num = wins_get_num(window);

    char *display_from = get_nick_from_full_jid(privatewin->fulljid);

    // currently viewing chat window with sender
    if (wins_is_current(window)) {
        win_print_incoming_message(window, timestamp, display_from, message, PROF_MSG_PLAIN);
        title_bar_set_typing(FALSE);
        status_bar_active(num);

    // not currently viewing chat window with sender
    } else {
        privatewin->unread++;
        status_bar_new(num);
        cons_show_incoming_message(display_from, num);
        win_print_incoming_message(window, timestamp, display_from, message, PROF_MSG_PLAIN);

        if (prefs_get_boolean(PREF_FLASH)) {
            flash();
        }
    }

    if (prefs_get_boolean(PREF_BEEP)) {
        beep();
    }

    if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
        notify_message(window, display_from, message);
    }

    free(display_from);
}
Exemple #19
0
HRESULT STDMETHODCALLTYPE CGainer::ExitContinousMode( void)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    notify_message(m_iothread_id, WM_COM_IO, "E*");
    return S_OK;
}
Exemple #20
0
unsigned int GMsgBox::process_key (GMessage& msg)
{
	unsigned int param;
	unsigned int res=0;
	GObject* tmp = focus;

	if(GWindow::process_key(msg))
		return 1;

	if( !text_box )
		return 0;

	switch (msg.param)
	{
	case KEY_RIGHT:
		if(focus)
		{
			if(focus->rect.y1 <= rect.y1)
			{
				if(text_box == focus || title_box == focus)
					break;	// It's a message or title_box, do nothing
				if(focus != last_available()) // It's not a last button
					res = focus_on_next();
				if(res)
					default_button = focus->id;
			}
			move(0,0);
		}
		break;

	case KEY_DOWN:
		if(focus)
		{
			if(focus->rect.y1 <= rect.y1)
			{
				if(focus == title_box)
				{
					// try to move on the text
					res = text_box->get_focus();
					if(!res)
					{
						// all text is visible, try buttons
						res = SelectDefaultButton(text_box->nextObj);
						if(!res)
						{
							// without buttons, do nothing
							break;
						}
					}
				}
				else
				{
					if(text_box == focus)
					{	// move on the buttons
						res = SelectDefaultButton(text_box->nextObj);
						if(!res)
						{
							// without buttons, try title
							if(title_box)
							{
								res = title_box->get_focus();
								if(!res)
								{
									// all text is visible and no buttons, scroll to title
									focus = title_box;
									focus->flags |= GO_FLG_ENABLED;
									move(0,0);
									focus->flags &= ~GO_FLG_ENABLED;
									focus = tmp;
									break;
								}
							}
						}
					}
					else
					{
						// at buttons
						if(title_box && title_box->rect.y0 <= rect.y0) // title not full visible
						{
							// try title
							res = title_box->get_focus();
							if(!res)
							{
								// all text visible and has a title
								focus = title_box;
								focus->flags |= GO_FLG_ENABLED;
								move(0,0);
								focus->flags &= ~GO_FLG_ENABLED;
								focus = tmp;
								break;
							}
						}
						else
						{
							res = text_box->get_focus();
							if(!res)
							{
								// all text visible and no title
								focus = text_box;
								focus->flags |= GO_FLG_ENABLED;
								move(0,0);
								focus->flags &= ~GO_FLG_ENABLED;
								focus = tmp;
								break;
							}
						}
					}
				}
			}
			move(0,0);
		}
		break;

	case KEY_LEFT:
		if(focus)
		{
			if(focus->rect.y1 <= rect.y1)
			{
				if(text_box == focus || title_box == focus) // It's a message, do nothing
					break;
				if(text_box->nextObj != focus) // It's not a first button
					res =  focus_on_previous();
				if(res)
					default_button = focus->id;
			}
			move(0,0);
		}
		break;

	case KEY_UP:
		if(focus)
		{
			if(focus->rect.y1 <= rect.y1)
			{
				if(focus == title_box)
				{
					// at the title
					// try to go on the buttons
					res = SelectDefaultButton(text_box->nextObj);
					if(!res)
					{
						// box without buttons.
						res = text_box->get_focus();
						if(!res)
						{
							// the whole message is visible on the screen
							// do nothing
							break;
						}
					}
				}
				else
				{
					if(focus == text_box)
					{
						// at the text
						// text can be scrolled, try to select title
						if(title_box)
						{
							res = title_box->get_focus();
							if(!res)
							{
								// try to go on buttons
								res = SelectDefaultButton(text_box->nextObj);
								if(!res)
								{
									// box with text only
								}
							}
						}
						else
						{
							//box without title, we are at text. try to select buttons
							res = SelectDefaultButton(text_box->nextObj);
							if(!res)
							{
								// box with text only and all text is visible
								break;
							}
						}
					}
					else
					{
						// at the button
						res = text_box->get_focus();
						if(!res)
						{
							// all text is visible
							if(title_box)
							{
								// has a title, move to it
								res = title_box->get_focus();
								if(!res)
								{
									focus = title_box;
									focus->flags |= GO_FLG_ENABLED;
									move(0,0);
									focus->flags &= ~GO_FLG_ENABLED;
									focus = tmp;
									break;
								}
							}
							else
								break;
						}
					}
				}
			}
			move(0,0);
		}
		break;

	case KEY_OK:
		if (!(type & (MBF_LAST_BTN-1)) || (type & ((MBF_LAST_BTN-1))) == MBF_OK )
		{
			notify_message(WM_CLOSE, GO_IDOK, this);
			return 1;
		}
		break;

	case KEY_CANCEL:
		switch((type&(MBF_LAST_BTN-1)))
		{
		case 0: // no buttons
			param = GO_EXIT;
		case MB_OKCANCEL:
		case MB_RETRYCANCEL:
		case MB_YESNOCANCEL:
			param = GO_IDCANCEL;
			break;
		case MB_YESNO:
			param = GO_IDNO;
			break;
		default:
			return 0;
		}
		notify_message(WM_CLOSE, param, this);
		return 1;
		break;

	default:
		return 0;
	}

	return res;
}
Exemple #21
0
void
chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode)
{
    assert(chatwin != NULL);

    char *plugin_message = plugins_pre_chat_message_display(chatwin->barejid, message);

    ProfWin *window = (ProfWin*)chatwin;
    int num = wins_get_num(window);

    char *display_name = roster_get_msg_display_name(chatwin->barejid, resource);

    gboolean is_current = wins_is_current(window);
    gboolean notify = prefs_do_chat_notify(is_current);

    // currently viewing chat window with sender
    if (wins_is_current(window)) {
        win_print_incoming_message(window, timestamp, display_name, plugin_message, enc_mode);
        title_bar_set_typing(FALSE);
        status_bar_active(num);

    // not currently viewing chat window with sender
    } else {
        status_bar_new(num);
        cons_show_incoming_message(display_name, num, chatwin->unread);

        if (prefs_get_boolean(PREF_FLASH)) {
            flash();
        }

        chatwin->unread++;

        if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
            _chatwin_history(chatwin, chatwin->barejid);
        }

        // show users status first, when receiving message via delayed delivery
        if (timestamp && win_created) {
            PContact pcontact = roster_get_contact(chatwin->barejid);
            if (pcontact) {
                win_show_contact(window, pcontact);
            }
        }

        win_print_incoming_message(window, timestamp, display_name, plugin_message, enc_mode);
    }

    if (prefs_get_boolean(PREF_BEEP)) {
        beep();
    }

    if (notify) {
        notify_message(display_name, num, plugin_message);
    }

    free(display_name);

    plugins_post_chat_message_display(chatwin->barejid, plugin_message);

    free(plugin_message);
}
Exemple #22
0
void
ui_incoming_msg(const char * const from, const char * const message,
    GTimeVal *tv_stamp, gboolean priv)
{
    gboolean win_created = FALSE;
    char *display_from = NULL;
    win_type_t win_type;

    if (priv) {
        win_type = WIN_PRIVATE;
        display_from = get_nick_from_full_jid(from);
    } else {
        win_type = WIN_CHAT;
        PContact contact = roster_get_contact(from);
        if (contact != NULL) {
            if (p_contact_name(contact) != NULL) {
                display_from = strdup(p_contact_name(contact));
            } else {
                display_from = strdup(from);
            }
        } else {
            display_from = strdup(from);
        }
    }

    ProfWin *window = wins_get_by_recipient(from);
    if (window == NULL) {
        window = wins_new(from, win_type);
        win_created = TRUE;
    }

    int num = wins_get_num(window);

    // currently viewing chat window with sender
    if (wins_is_current(window)) {
        if (tv_stamp == NULL) {
            win_print_time(window, '-');
        } else {
            GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
            gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
            wattron(window->win, COLOUR_TIME);
            wprintw(window->win, "%s - ", date_fmt);
            wattroff(window->win, COLOUR_TIME);
            g_date_time_unref(time);
            g_free(date_fmt);
        }

        if (strncmp(message, "/me ", 4) == 0) {
            wattron(window->win, COLOUR_THEM);
            wprintw(window->win, "*%s ", display_from);
            waddstr(window->win, message + 4);
            wprintw(window->win, "\n");
            wattroff(window->win, COLOUR_THEM);
        } else {
            _win_show_user(window->win, display_from, 1);
            _win_show_message(window->win, message);
        }
        title_bar_set_typing(FALSE);
        title_bar_draw();
        status_bar_active(num);
        wins_refresh_current();

    // not currently viewing chat window with sender
    } else {
        status_bar_new(num);
        cons_show_incoming_message(display_from, num);
        if (prefs_get_boolean(PREF_FLASH))
            flash();

        window->unread++;
        if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
            _win_show_history(window->win, num, from);
        }

        if (tv_stamp == NULL) {
            win_print_time(window, '-');
        } else {
            // show users status first, when receiving message via delayed delivery
            if (win_created) {
                PContact pcontact = roster_get_contact(from);
                if (pcontact != NULL) {
                    win_show_contact(window, pcontact);
                }
            }
            GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
            gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
            wattron(window->win, COLOUR_TIME);
            wprintw(window->win, "%s - ", date_fmt);
            wattroff(window->win, COLOUR_TIME);
            g_date_time_unref(time);
            g_free(date_fmt);
        }

        if (strncmp(message, "/me ", 4) == 0) {
            wattron(window->win, COLOUR_THEM);
            wprintw(window->win, "*%s ", display_from);
            waddstr(window->win, message + 4);
            wprintw(window->win, "\n");
            wattroff(window->win, COLOUR_THEM);
        } else {
            _win_show_user(window->win, display_from, 1);
            _win_show_message(window->win, message);
        }
    }

    int ui_index = num;
    if (ui_index == 10) {
        ui_index = 0;
    }

    if (prefs_get_boolean(PREF_BEEP))
        beep();
    if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
        notify_message(display_from, ui_index);

    free(display_from);
}
Exemple #23
0
gboolean display_message(gchar * summary, gchar * body, glong timeout)
{

  notify_message(summary, body, NULL, -1);
  return FALSE;
}
Exemple #24
0
void date_dialog::notify_calendar_value() {
  notify_message("date",
                 priv->m_cal_widget->selected_date().toString().toStdString());
}
Exemple #25
0
HRESULT STDMETHODCALLTYPE CGainer::Reboot( void)
{
    if (!m_iothread) return Error(IDS_E_NOTOPENED);
    notify_message(m_iothread_id, WM_COM_IO, "Q*");
    return S_OK;
}