pidgin/resources/Conversations/message.ui

Fri, 20 Oct 2023 11:46:49 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 20 Oct 2023 11:46:49 -0500
changeset 42380
165c0b7f3860
parent 42350
0d5319e4b836
child 42500
8c3183cb6b7a
permissions
-rw-r--r--

Escape message content in Pidgin before displaying it

While testing the IRCv3 channel stuff we got an invalid markup error because
someone sent `>_<` which caused a pango markup failure. We only escape in
Pidgin because this is a ui quirk.

Testing Done:
Had Twitch chat try to break it.

Bugs closed: PIDGIN-17837

Reviewed at https://reviews.imfreedom.org/r/2679/

<?xml version="1.0" encoding="UTF-8"?>
<!--
Pidgin - Internet Messenger
Copyright (C) Pidgin Developers <devel@pidgin.im>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this library; if not, see <https://www.gnu.org/licenses/>.
-->
<interface>
  <requires lib="gtk" version="4.0"/>
  <template class="GtkListItem">
    <property name="child">
      <object class="GtkBox">
        <child>
          <object class="GtkImage" id="avatar">
            <property name="icon-name">image-missing</property>
            <property name="visible">0</property>
          </object>
        </child>
        <child>
          <object class="GtkBox">
            <property name="hexpand">1</property>
            <property name="orientation">vertical</property>
            <child>
              <object class="GtkBox">
                <property name="spacing">8</property>
                <child>
                  <object class="GtkLabel" id="author">
                    <binding name="label">
                      <lookup name="author" type="PurpleMessage">
                        <lookup name="item">GtkListItem</lookup>
                      </lookup>
                    </binding>
                    <binding name="attributes">
                      <closure type="PangoAttrList" function="pidgin_conversation_get_author_attributes">
                        <lookup name="item">GtkListItem</lookup>
                      </closure>
                    </binding>
                  </object>
                </child>
                <child>
                  <object class="GtkLabel" id="timestamp">
                    <binding name="label">
                      <closure type="gchararray" function="pidgin_converation_get_timestamp_string">
                        <lookup name="item">GtkListItem</lookup>
                      </closure>
                    </binding>
                    <property name="has-tooltip">1</property>
                    <signal name="query-tooltip" handler="pidgin_conversation_query_tooltip_timestamp_cb"/>
                  </object>
                </child>
                <child>
                  <object class="GtkLabel" id="edited">
                    <binding name="visible">
                      <lookup name="edited" type="PurpleMessage">
                        <lookup name="item">GtkListItem</lookup>
                      </lookup>
                    </binding>
                    <property name="label" translatable="yes">(edited)</property>
                    <property name="has-tooltip">1</property>
                    <signal name="query-tooltip" handler="pidgin_conversation_query_tooltip_edited_cb"/>
                  </object>
                </child>
              </object>
            </child>
            <child>
              <object class="GtkLabel" id="content">
                <property name="wrap">1</property>
                <property name="wrap-mode">word-char</property>
                <property name="xalign">0</property>
                <property name="yalign">0</property>
                <property name="use-markup">1</property>
                <binding name="label">
                  <!-- this file is used by a GtkItemFactory in
                      PidginConversation which is why the function name has a
                      pidgin_conversation prefix.
                    -->
                  <closure type="gchararray" function="pidgin_conversation_process_message_contents_cb">
                    <lookup name="contents" type="PurpleMessage">
                      <lookup name="item">GtkListItem</lookup>
                    </lookup>
                  </closure>
                </binding>
              </object>
            </child>
          </object>
        </child>
      </object>
    </property>
  </template>
</interface>

mercurial