static void composer_move_caret (EMsgComposer *composer) { EHTMLEditor *editor; EHTMLEditorView *view; EHTMLEditorSelection *editor_selection; GSettings *settings; gboolean start_bottom, top_signature; gboolean is_message_from_draft; gboolean is_message_from_edit_as_new; gboolean has_paragraphs_in_body = TRUE; WebKitDOMDocument *document; WebKitDOMElement *element, *signature; WebKitDOMHTMLElement *body; WebKitDOMNodeList *list; /* When there is an option composer-reply-start-bottom set we have * to move the caret between reply and signature. */ settings = e_util_ref_settings ("org.gnome.evolution.mail"); start_bottom = g_settings_get_boolean (settings, "composer-reply-start-bottom"); g_object_unref (settings); editor = e_msg_composer_get_editor (composer); view = e_html_editor_get_view (editor); editor_selection = e_html_editor_view_get_selection (view); is_message_from_draft = e_html_editor_view_is_message_from_draft (view); is_message_from_edit_as_new = e_html_editor_view_is_message_from_edit_as_new (view); top_signature = use_top_signature (composer) && !is_message_from_edit_as_new && !composer->priv->is_from_new_message; document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view)); body = webkit_dom_document_get_body (document); webkit_dom_element_set_attribute ( WEBKIT_DOM_ELEMENT (body), "data-message", "", NULL); /* If editing message as new don't handle with caret */ if (is_message_from_edit_as_new || is_message_from_draft) { if (is_message_from_edit_as_new) webkit_dom_element_set_attribute ( WEBKIT_DOM_ELEMENT (body), "data-edit-as-new", "", NULL); if (is_message_from_edit_as_new && !is_message_from_draft) { element = WEBKIT_DOM_ELEMENT (body); e_html_editor_selection_block_selection_changed (editor_selection); goto move_caret; } else e_html_editor_selection_scroll_to_caret (editor_selection); return; } e_html_editor_selection_block_selection_changed (editor_selection); /* When the new message is written from the beginning - note it into body */ if (composer->priv->is_from_new_message) webkit_dom_element_set_attribute ( WEBKIT_DOM_ELEMENT (body), "data-new-message", "", NULL); list = webkit_dom_document_get_elements_by_class_name (document, "-x-evo-paragraph"); signature = webkit_dom_document_query_selector (document, ".-x-evo-signature-wrapper", NULL); /* Situation when wrapped paragraph is just in signature and not in message body */ if (webkit_dom_node_list_get_length (list) == 1) if (signature && webkit_dom_element_query_selector (signature, ".-x-evo-paragraph", NULL)) has_paragraphs_in_body = FALSE; /* * * Keeping Signatures in the beginning of composer * ------------------------------------------------ * * Purists are gonna blast me for this. * But there are so many people (read Outlook users) who want this. * And Evo is an exchange-client, Outlook-replacement etc. * So Here it goes :( * * -- Sankar * */ if (signature && top_signature) { WebKitDOMElement *spacer; spacer = prepare_top_signature_spacer (editor_selection, document); webkit_dom_node_insert_before ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (spacer), webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (signature)), NULL); } if (webkit_dom_node_list_get_length (list) == 0) has_paragraphs_in_body = FALSE; element = webkit_dom_document_get_element_by_id (document, "-x-evo-input-start"); if (!signature) { if (start_bottom) { if (!element) { element = prepare_paragraph (editor_selection, document); webkit_dom_node_append_child ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (element), NULL); } } else element = WEBKIT_DOM_ELEMENT (body); g_object_unref (list); goto move_caret; } if (!has_paragraphs_in_body) { element = prepare_paragraph (editor_selection, document); if (top_signature) { if (start_bottom) { webkit_dom_node_append_child ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (element), NULL); } else { webkit_dom_node_insert_before ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (element), WEBKIT_DOM_NODE (signature), NULL); } } else { if (start_bottom) webkit_dom_node_insert_before ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (element), WEBKIT_DOM_NODE (signature), NULL); else element = WEBKIT_DOM_ELEMENT (body); } } else { if (!element && top_signature) { element = prepare_paragraph (editor_selection, document); if (start_bottom) { webkit_dom_node_append_child ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (element), NULL); } else { webkit_dom_node_insert_before ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (element), WEBKIT_DOM_NODE (signature), NULL); } } else if (element && top_signature && !start_bottom) { webkit_dom_node_insert_before ( WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (element), WEBKIT_DOM_NODE (signature), NULL); } else if (element && start_bottom) { /* Leave it how it is */ } else element = WEBKIT_DOM_ELEMENT (body); } g_object_unref (list); move_caret: if (element) { WebKitDOMDOMSelection *dom_selection; WebKitDOMDOMWindow *dom_window; WebKitDOMRange *range; dom_window = webkit_dom_document_get_default_view (document); dom_selection = webkit_dom_dom_window_get_selection (dom_window); range = webkit_dom_document_create_range (document); webkit_dom_range_select_node_contents ( range, WEBKIT_DOM_NODE (element), NULL); webkit_dom_range_collapse (range, TRUE, NULL); webkit_dom_dom_selection_remove_all_ranges (dom_selection); webkit_dom_dom_selection_add_range (dom_selection, range); g_clear_object (&dom_selection); g_clear_object (&dom_window); g_clear_object (&range); if (start_bottom) e_html_editor_selection_scroll_to_caret (editor_selection); } if (start_bottom) g_signal_connect ( view, "size-allocate", G_CALLBACK (composer_size_allocate_cb), NULL); e_html_editor_view_force_spell_check_in_viewport (view); e_html_editor_selection_unblock_selection_changed (editor_selection); }
void plugins_create_click_element(WebKitDOMElement *element, GList *gl) { WebKitDOMNode *parent = webkit_dom_node_get_parent_node(WEBKIT_DOM_NODE(element)); View *v = VIEW(gl); WebKitDOMElement *div; if (parent == NULL) return; WebKitDOMDocument *doc = webkit_dom_node_get_owner_document(WEBKIT_DOM_NODE(element)); WebKitDOMDOMWindow *win = webkit_dom_document_get_default_view(doc); WebKitDOMCSSStyleDeclaration *style = webkit_dom_dom_window_get_computed_style(win, element, ""); char *width = webkit_dom_css_style_declaration_get_property_value(style, "width"); char *height = webkit_dom_css_style_declaration_get_property_value(style, "height"); char *top = webkit_dom_css_style_declaration_get_property_value(style, "top"); char *left = webkit_dom_css_style_declaration_get_property_value(style, "left"); char *position = webkit_dom_css_style_declaration_get_property_value(style, "position"); int w, h; if (sscanf(width, "%dpx", &w) == 1 && w<72) w = 72; if (sscanf(height, "%dpx", &h) == 1 && h<24) h = 24; if (v->plugins->max <= v->plugins->created) { div = webkit_dom_document_create_element(doc, "div", NULL); v->plugins->clicks = g_slist_prepend(v->plugins->clicks, div); v->plugins->max++; } else div = g_slist_nth_data(v->plugins->clicks, v->plugins->created); webkit_dom_html_element_set_inner_html(WEBKIT_DOM_HTML_ELEMENT(div), "<div style='display:table-cell;vertical-align:middle;text-align:center;color:#fff;background:#000;border:1px solid #666;font:11px monospace bold'>click to enable flash</div>", NULL); char *new_style = g_strdup_printf("position:%s;width:%dpx;height:%dpx;top:%s;left:%s;display:table;z-index:37000;", position, w, h, top, left); webkit_dom_element_set_attribute(div, "style", new_style, NULL); g_free(new_style); webkit_dom_element_set_attribute(div, "onclick", "return", NULL); g_object_set_data((gpointer)div, "dwb-plugin-element", element); webkit_dom_node_remove_child(parent, WEBKIT_DOM_NODE(element), NULL); webkit_dom_node_append_child(parent, WEBKIT_DOM_NODE(div), NULL); v->plugins->elements = g_slist_prepend(v->plugins->elements, element); webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(div), "click", G_CALLBACK(plugins_onclick_cb), true, gl); g_object_unref(style); g_object_unref(parent); v->plugins->created++; }
static WebKitDOMElement *webkit_element_avatar_img(WebKitDOMDocument * doc, const gchar * avatar) { WebKitDOMElement *img = webkit_dom_document_create_element(doc, "img", NULL); webkit_dom_element_set_attribute(img, "src", avatar, NULL); webkit_dom_element_set_attribute(img, "width", "40px", NULL); webkit_dom_element_set_attribute(img, "height", "40px", NULL); webkit_dom_element_set_attribute(img, "class", "chat_content_avatar", NULL); return img; }
static WebKitDOMElement * webkit_element_chat_content_group(WebKitDOMDocument * doc, const gchar * avatar, WqqQQChatMessage * msg) { WebKitDOMElement *chat_content_group = webkit_dom_document_create_element(doc, "div", NULL); WebKitDOMElement *chat_content_avatar = webkit_element_avatar_img(doc, avatar); webkit_dom_node_append_child(WEBKIT_DOM_NODE(chat_content_group), WEBKIT_DOM_NODE(chat_content_avatar), NULL); WebKitDOMElement *chat_nick = webkit_dom_document_create_element(doc, "p", NULL); webkit_dom_element_set_attribute(chat_nick, "class", "chat_nick", NULL); webkit_dom_node_set_text_content(WEBKIT_DOM_NODE(chat_nick), msg->nick, NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(chat_content_group), WEBKIT_DOM_NODE(chat_nick), NULL); WebKitDOMElement *chat_content = webkit_element_chat_content(doc, msg); webkit_dom_node_append_child(WEBKIT_DOM_NODE(chat_content_group), WEBKIT_DOM_NODE(chat_content), NULL); return chat_content_group; }
void wqq_qqchat_append_time(WqqQQChat * chat, GDateTime * dt) { g_return_if_fail(WQQ_IS_QQCHAT(chat)); while (chat->loading) { gtk_main_iteration_do(TRUE); } gchar *now = g_date_time_format(dt, "%m-%d %k:%M"); WebKitDOMDocument *doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(chat->webview)); WebKitDOMElement *body = webkit_dom_document_query_selector(doc, "body", NULL); WebKitDOMElement *div = webkit_dom_document_create_element(doc, "div", NULL); WebKitDOMElement *span = webkit_dom_document_create_element(doc, "span", NULL); webkit_dom_element_set_attribute(div, "class", "chat_time", NULL); webkit_dom_node_set_text_content(WEBKIT_DOM_NODE(span), now, NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(body), WEBKIT_DOM_NODE(div), NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(div), WEBKIT_DOM_NODE(span), NULL); g_free(now); }
static void html_editor_image_dialog_set_height_units (EHTMLEditorImageDialog *dialog) { gint requested; gulong natural; gint height = -1; natural = webkit_dom_html_image_element_get_natural_height ( dialog->priv->image); requested = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON (dialog->priv->height_edit)); switch (gtk_combo_box_get_active ( GTK_COMBO_BOX (dialog->priv->height_units))) { case 0: /* px */ if (gtk_widget_is_sensitive (dialog->priv->height_edit)) { height = requested * natural * 0.01; } else { height = natural; } webkit_dom_element_remove_attribute ( WEBKIT_DOM_ELEMENT (dialog->priv->image), "style"); gtk_widget_set_sensitive (dialog->priv->height_edit, TRUE); break; case 1: /* percent */ if (gtk_widget_is_sensitive (dialog->priv->height_edit)) { height = (((gdouble) requested) / natural) * 100; } else { height = 100; } webkit_dom_element_remove_attribute ( WEBKIT_DOM_ELEMENT (dialog->priv->image), "style"); gtk_widget_set_sensitive (dialog->priv->height_edit, TRUE); break; case 2: /* follow */ webkit_dom_element_set_attribute ( WEBKIT_DOM_ELEMENT (dialog->priv->image), "style", "height: auto;", NULL); gtk_widget_set_sensitive (dialog->priv->height_edit, FALSE); break; } if (height != -1) { gtk_spin_button_set_value ( GTK_SPIN_BUTTON (dialog->priv->height_edit), height); } }
void wqq_qqchat_append_message_from_self(WqqQQChat * chat, const gchar * avatar, WqqQQChatMessage * msg) { g_return_if_fail(WQQ_IS_QQCHAT(chat) && msg != NULL); while (chat->loading) { gtk_main_iteration_do(TRUE); } WebKitDOMDocument *doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(chat->webview)); WebKitDOMElement *body = webkit_dom_document_query_selector(doc, "body", NULL); WebKitDOMElement *chat_content_group = webkit_element_chat_content_group(doc, avatar, msg); webkit_dom_element_set_attribute(chat_content_group, "class", "chat_content_group self", NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(body), WEBKIT_DOM_NODE(chat_content_group), NULL); }
static void test_dom_document_garbage_collection(DomDocumentFixture* fixture, gconstpointer data) { guint count = 0; g_assert(fixture); WebKitWebView* view = (WebKitWebView*)fixture->webView; g_assert(view); WebKitDOMDocument* document = webkit_web_view_get_dom_document(view); g_assert(document); g_object_weak_ref(G_OBJECT(document), (GWeakNotify)weak_notify, &count); WebKitDOMHTMLHeadElement* head = webkit_dom_document_get_head(document); g_assert(head); g_object_weak_ref(G_OBJECT(head), (GWeakNotify)weak_notify, &count); WebKitDOMHTMLElement* body = webkit_dom_document_get_body(document); g_assert(body); g_object_weak_ref(G_OBJECT(body), (GWeakNotify)weak_notify, &count); WebKitDOMHTMLCollection *collection = webkit_dom_document_get_links(document); g_assert(collection); g_object_weak_ref(G_OBJECT(collection), (GWeakNotify)weak_notify, &count); webkit_web_view_load_string(WEBKIT_WEB_VIEW(view), HTML_DOCUMENT_LINKS, NULL, NULL, NULL); while (g_main_context_pending(NULL)) g_main_context_iteration(NULL, FALSE); g_assert_cmpuint(count, ==, 3); g_object_unref(collection); g_assert_cmpuint(count, ==, 4); count = 0; document = webkit_web_view_get_dom_document(view); g_assert(document); g_object_weak_ref(G_OBJECT(document), (GWeakNotify)weak_notify, &count); head = webkit_dom_document_get_head(document); g_assert(head); g_object_weak_ref(G_OBJECT(head), (GWeakNotify)weak_notify, &count); body = webkit_dom_document_get_body(document); g_assert(body); g_object_weak_ref(G_OBJECT(body), (GWeakNotify)weak_notify, &count); collection = webkit_dom_document_get_links(document); g_assert(collection); g_object_weak_ref(G_OBJECT(collection), (GWeakNotify)weak_notify, &count); /* Ask twice for the same object */ WebKitDOMHTMLCollection* collection2 = webkit_dom_document_get_links(document); g_assert(collection2); g_object_weak_ref(G_OBJECT(collection2), (GWeakNotify)weak_notify, &count); g_object_unref(document); g_object_unref(head); g_object_unref(body); g_object_unref(collection); g_object_unref(collection2); g_assert_cmpuint(count, ==, 5); webkit_web_view_load_string(WEBKIT_WEB_VIEW(view), HTML_DOCUMENT_IFRAME, NULL, NULL, NULL); while (g_main_context_pending(NULL)) g_main_context_iteration(NULL, FALSE); count = 0; document = webkit_web_view_get_dom_document(view); WebKitDOMElement* div = webkit_dom_document_get_element_by_id(document, "test"); g_assert(div); g_object_weak_ref(G_OBJECT(div), (GWeakNotify)weak_notify, &count); WebKitDOMElement* iframe = webkit_dom_document_get_element_by_id(document, "iframe"); g_assert(iframe); webkit_dom_element_set_attribute(iframe, "src", "data:<html><head></head></html>", NULL); while (g_main_context_pending(NULL)) g_main_context_iteration(NULL, FALSE); WebKitDOMDocument* iframeDocument = webkit_dom_html_iframe_element_get_content_document(WEBKIT_DOM_HTML_IFRAME_ELEMENT(iframe)); g_assert(iframeDocument); head = webkit_dom_document_get_head(iframeDocument); g_assert(head); g_object_weak_ref(G_OBJECT(head), (GWeakNotify)weak_notify, &count); webkit_dom_element_set_attribute(iframe, "src", "about:blank", NULL); while (g_main_context_pending(NULL)) g_main_context_iteration(NULL, FALSE); g_assert_cmpuint(count, ==, 1); webkit_web_view_load_string(WEBKIT_WEB_VIEW(view), HTML_DOCUMENT_LINKS, NULL, NULL, NULL); while (g_main_context_pending(NULL)) g_main_context_iteration(NULL, FALSE); g_assert_cmpuint(count, ==, 2); count = 0; document = webkit_web_view_get_dom_document(view); g_assert(document); g_object_weak_ref(G_OBJECT(document), (GWeakNotify)weak_notify, &count); /* Ask twice for the Document */ WebKitDOMDocument* document2 = webkit_web_view_get_dom_document(view); g_assert(document2); g_object_weak_ref(G_OBJECT(document2), (GWeakNotify)weak_notify, &count); head = webkit_dom_document_get_head(document); g_assert(head); g_object_weak_ref(G_OBJECT(head), (GWeakNotify)weak_notify, &count); body = webkit_dom_document_get_body(document); g_assert(body); g_object_weak_ref(G_OBJECT(body), (GWeakNotify)weak_notify, &count); collection = webkit_dom_document_get_links(document); g_assert(collection); g_object_weak_ref(G_OBJECT(collection), (GWeakNotify)weak_notify, &count); gtk_widget_destroy(fixture->webView); fixture->webView = NULL; g_assert_cmpuint(count, ==, 4); g_object_unref(collection); g_assert_cmpuint(count, ==, 5); }
void e_editor_selection_set_block_format (EEditorSelection *selection, EEditorSelectionBlockFormat format) { EEditorSelectionBlockFormat current_format; WebKitDOMDocument *document; const gchar *command; const gchar *value; g_return_if_fail (E_IS_EDITOR_SELECTION (selection)); current_format = e_editor_selection_get_block_format (selection); if (current_format == format) { return; } document = webkit_web_view_get_dom_document (selection->priv->webview); switch (format) { case E_EDITOR_SELECTION_BLOCK_FORMAT_BLOCKQUOTE: command = "formatBlock"; value = "BLOCKQUOTE"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_H1: command = "formatBlock"; value = "H1"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_H2: command = "formatBlock"; value = "H2"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_H3: command = "formatBlock"; value = "H3"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_H4: command = "formatBlock"; value = "H4"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_H5: command = "formatBlock"; value = "H5"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_H6: command = "formatBlock"; value = "H6"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH: command = "formatBlock"; value = "P"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_PRE: command = "formatBlock"; value = "PRE"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_ADDRESS: command = "formatBlock"; value = "ADDRESS"; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST: case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ALPHA: case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ROMAN: command = "insertOrderedList"; value = ""; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_UNORDERED_LIST: command = "insertUnorderedList"; value = ""; break; case E_EDITOR_SELECTION_BLOCK_FORMAT_NONE: default: command = "removeFormat"; value = ""; break; } /* First remove (un)ordered list before changing formatting */ if (current_format == E_EDITOR_SELECTION_BLOCK_FORMAT_UNORDERED_LIST) { webkit_dom_document_exec_command ( document, "insertUnorderedList", FALSE, ""); /* ^-- not a typo, "insert" toggles the formatting * if already present */ } else if (current_format >= E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST) { webkit_dom_document_exec_command ( document, "insertOrderedList", FALSE ,""); } webkit_dom_document_exec_command ( document, command, FALSE, value); /* Fine tuning - set the specific marker type for ordered lists */ if ((format == E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ALPHA) || (format == E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ROMAN)) { WebKitDOMRange *range = editor_selection_get_current_range (selection); WebKitDOMNode *node; WebKitDOMElement *list; node = webkit_dom_range_get_start_container (range, NULL); list = e_editor_dom_node_find_child_element (node, "OL"); if (!list) { list = e_editor_dom_node_find_parent_element (node, "OL"); } if (list) { webkit_dom_element_set_attribute ( list, "type", (format == E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ALPHA) ? "A" : "I", NULL); } } g_object_notify (G_OBJECT (selection), "block-format"); }
static WebKitDOMElement *webkit_element_chat_content(WebKitDOMDocument * doc, WqqQQChatMessage * msg) { WebKitDOMElement *ct = webkit_dom_document_create_element(doc, "p", NULL); webkit_dom_element_set_attribute(ct, "class", "chat_content", NULL); GList *lp = msg->list; WqqQQChatMessageContent *mct; WebKitDOMElement *span, *img, *br, *inspan; while (lp != NULL) { mct = (WqqQQChatMessageContent *) lp->data; switch (mct->type) { case WQQ_QQCHAT_MESSAGE_TYPE_TEXT: span = webkit_dom_document_create_element(doc, "span", NULL); gchar **strv = g_strsplit(mct->text, "\n", -1); if (strv) { guint i = 0; guint len = g_strv_length(strv); for (i = 0; i < len - 1; i++) { br = webkit_dom_document_create_element(doc, "br", NULL); inspan = webkit_dom_document_create_element(doc, "span", NULL); webkit_dom_node_set_text_content(WEBKIT_DOM_NODE (inspan), strv[i], NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(inspan), WEBKIT_DOM_NODE(br), NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(span), WEBKIT_DOM_NODE(inspan), NULL); } inspan = webkit_dom_document_create_element(doc, "span", NULL); webkit_dom_node_set_text_content(WEBKIT_DOM_NODE(inspan), strv[i], NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(span), WEBKIT_DOM_NODE(inspan), NULL); g_strfreev(strv); } webkit_dom_node_append_child(WEBKIT_DOM_NODE(ct), WEBKIT_DOM_NODE(span), NULL); break; case WQQ_QQCHAT_MESSAGE_TYPE_IMAGE: img = webkit_dom_document_create_element(doc, "img", NULL); webkit_dom_element_set_attribute(img, "class", "icon", NULL); webkit_dom_element_set_attribute(img, "src", mct->image, NULL); webkit_dom_node_append_child(WEBKIT_DOM_NODE(ct), WEBKIT_DOM_NODE(img), NULL); break; case WQQ_QQCHAT_MESSAGE_TYPE_FACE: default: break; } lp = g_list_next(lp); } return ct; }