コード例 #1
0
ファイル: menu.c プロジェクト: arinity/gchat2
void
nick_command_parse (session *sess, char *cmd, char *nick, char *allnick)
{
	char *buf;
	char *host = _("Host unknown");
	struct User *user;
	int len;

/*	if (sess->type == SESS_DIALOG)
	{
		buf = (char *)(GTK_ENTRY (sess->gui->topic_entry)->text);
		buf = strrchr (buf, '@');
		if (buf)
			host = buf + 1;
	} else*/
	{
		user = userlist_find (sess, nick);
		if (user && user->hostname)
			host = strchr (user->hostname, '@') + 1;
	}

	/* this can't overflow, since popup->cmd is only 256 */
	len = strlen (cmd) + strlen (nick) + strlen (allnick) + 512;
	buf = malloc (len);

	auto_insert (buf, len, cmd, 0, 0, allnick, sess->channel, "",
					 server_get_network (sess->server, TRUE), host,
					 sess->server->nick, nick);

	nick_command (sess, buf);

	free (buf);
}
コード例 #2
0
ファイル: ctcp.c プロジェクト: UIKit0/picogui
static void
ctcp_reply (session *sess, char *tbuf, char *nick, char *word[],
				char *word_eol[], char *conf)
{
	auto_insert (tbuf, conf, word, word_eol, "", "", word_eol[5], "", "", nick);

	handle_command (tbuf, sess, 0, 0);
}
コード例 #3
0
ファイル: dom.c プロジェクト: b80905/vimb
static gboolean editable_focus_cb(Element *element, Event *event)
{
    if (vb.state.done_loading_page || !vb.config.strict_focus) {
        auto_insert((Element*)webkit_dom_event_get_target(event));
    }

    return false;
}
コード例 #4
0
ファイル: dom.c プロジェクト: uggedal/vimb
static gboolean editable_focus_cb(Element *element, Event *event)
{
    webkit_dom_event_target_remove_event_listener(
        WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(editable_focus_cb), false
    );
    if (vb.mode->id != 'i') {
        EventTarget *target = webkit_dom_event_get_target(event);
        auto_insert((void*)target);
    }
    return false;
}
コード例 #5
0
ファイル: dialog.c プロジェクト: UIKit0/picogui
static void
dialog_button_cb (GtkWidget *wid, char *cmd)
{
	/* the longest cmd is 12, and the longest nickname is 64 */
	char buf[128];

	if (!menu_sess)
		return;

	auto_insert (buf, cmd, 0, 0, "", "", "", "", "", menu_sess->channel);

	handle_command (buf, menu_sess, FALSE, FALSE);
}
コード例 #6
0
ファイル: ctcp.c プロジェクト: Kyuuketsuki/xchat-aqua
static void
ctcp_reply (session *sess, char *nick, char *word[], char *word_eol[],
				char *conf)
{
	char tbuf[4096];	/* can receive 2048 from IRC, so this is enough */

	conf = strdup (conf);
	/* process %C %B etc */
	check_special_chars (conf, TRUE);
	auto_insert (tbuf, sizeof (tbuf), conf, word, word_eol, "", "", word_eol[5],
					 server_get_network (sess->server, TRUE), "", "", nick);
	free (conf);
	handle_command (sess, tbuf, FALSE);
}
コード例 #7
0
ファイル: dom.c プロジェクト: b80905/vimb
void dom_check_auto_insert(Document *doc)
{
    Element *active = webkit_dom_html_document_get_active_element(WEBKIT_DOM_HTML_DOCUMENT(doc));

    if (active) {
        if (!vb.config.strict_focus) {
            auto_insert(active);
        } else if (vb.mode->id != 'i') {
            /* If strict-focus is enabled and the editable element becomes
             * focus, we explicitely remove the focus. But only if vimb isn't
             * in input mode at the time. This prevents from leaving input
             * mode that was started by user interaction like click to
             * editable element, or the 'gi' normal mode command. */
            webkit_dom_element_blur(active);
        }
    }
    dom_install_focus_blur_callbacks(doc);
}
コード例 #8
0
ファイル: dom.c プロジェクト: uggedal/vimb
void dom_check_auto_insert(WebKitWebView *view)
{
    Document *doc   = webkit_web_view_get_dom_document(view);
    Element *active = get_active_element(doc);

    if (vb.config.strict_focus || !auto_insert(active)) {
        /* if the strict-focus is on also blur the possible active element */
        if (vb.config.strict_focus) {
            dom_clear_focus(view);
        }
        /* the focus was not set automatically - add event listener to track
         * focus events on the document */
        HtmlElement *element = webkit_dom_document_get_body(doc);
        if (!element) {
            element = WEBKIT_DOM_HTML_ELEMENT(webkit_dom_document_get_document_element(doc));
        }
        webkit_dom_event_target_add_event_listener(
            WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(editable_focus_cb), false, NULL
        );
    }
}