<commit_before><?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
	"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
	<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
]>

<refentry id="example-mailclient">
<refmeta>
	<refentrytitle role="top_of_page" id="example-mailclient.top_of_page">Mail client</refentrytitle>
	<manvolnum>7</manvolnum>
	<refmiscinfo>
		LIBTINYNOTIFY Library
	</refmiscinfo>
</refmeta>
<refnamediv>
	<refname>Mail client</refname>
	<refpurpose>an example involving mail client checking mail for multiple accounts</refpurpose>
</refnamediv>

<refsect1 id="example-mailclient.description" role="desc">
	<title role="desc.title">Description</title>
	<para>
		The following example shows how to use libtinynotify to handle
		displaying new mail notification while doing mail fetching for multiple
		accounts.
	</para>

	<para>
		In this particular case, a <link linkend="NotifySession"><type>NotifySession</type></link>
		is instantiated globally which might not be the sanest solution but it's
		quite straightforward.
	</para>

	<para>
		A single <link linkend="Notification"><type>Notification</type></link>
		is instantiated for the whole mail checking process with a template
		summary &amp; body. The template is filled with actual numbers when
		notifications are displayed.
	</para>

	<para>
		Use of <link linkend="notification-update"><function>notification_update()</function></link>
		allows libtinynotify to keep track of notification display by server
		and replace the outdated notification with the one containing new
		numbers.
	</para>

	<example>
		<title>Mail client using libtinynotify</title>
		<programlisting><![CDATA[
NotifySession notify_session;
<commit_msg>Add the include to example.<commit_after><?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
	"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
	<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
]>

<refentry id="example-mailclient">
<refmeta>
	<refentrytitle role="top_of_page" id="example-mailclient.top_of_page">Mail client</refentrytitle>
	<manvolnum>7</manvolnum>
	<refmiscinfo>
		LIBTINYNOTIFY Library
	</refmiscinfo>
</refmeta>
<refnamediv>
	<refname>Mail client</refname>
	<refpurpose>an example involving mail client checking mail for multiple accounts</refpurpose>
</refnamediv>

<refsect1 id="example-mailclient.description" role="desc">
	<title role="desc.title">Description</title>
	<para>
		The following example shows how to use libtinynotify to handle
		displaying new mail notification while doing mail fetching for multiple
		accounts.
	</para>

	<para>
		In this particular case, a <link linkend="NotifySession"><type>NotifySession</type></link>
		is instantiated globally which might not be the sanest solution but it's
		quite straightforward.
	</para>

	<para>
		A single <link linkend="Notification"><type>Notification</type></link>
		is instantiated for the whole mail checking process with a template
		summary &amp; body. The template is filled with actual numbers when
		notifications are displayed.
	</para>

	<para>
		Use of <link linkend="notification-update"><function>notification_update()</function></link>
		allows libtinynotify to keep track of notification display by server
		and replace the outdated notification with the one containing new
		numbers.
	</para>

	<example>
		<title>Mail client using libtinynotify</title>
		<programlisting><![CDATA[
/* compile & link with libtinynotify.pc */
#include <tinynotify.h>

NotifySession notify_session;

{'fraction_non_alphanumeric': 0.11904761904761904, 'fraction_numerical': 0.0071154898741105635, 'mean_word_length': 5.301724137931035, 'pattern_counts': {'":': 0, '<': 96, '<?xml version=': 2, '>': 94, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6581719', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1128, 'n_words': 330}