Commit f8f69bc7 authored by Evangelos Ribeiro Tzaras's avatar Evangelos Ribeiro Tzaras
Browse files

Update upstream source from tag 'upstream/0.2.0'

Update to upstream version '0.2.0'
with Debian dir 1cf5bfede46b9328f136355923f30b352b7c1868
parents 2e246d47 668de041
......@@ -19,6 +19,7 @@ before_script:
- wget -O- https://ci.puri.sm/ci-repo.key | apt-key add -
- apt-get -y update
- apt-get -y build-dep .
- apt-get -y install libgtk-3-bin xvfb
build-debian-gcc-buster:
<<: *tags
......@@ -60,7 +61,7 @@ test:debian-gcc:
script:
- export G_DEBUG=fatal-warnings
- export LC_ALL=C.UTF-8
- ninja -C _build test
- xvfb-run -a -s "-screen 0 1024x768x24" ninja -C _build test
- ninja -C _build coverage
coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
......
......@@ -18,7 +18,7 @@ For an explicit list of dependencies check the Build-Depends entry in the
[debian/control](https://source.puri.sm/Librem5/chatty/blob/master/debian/control#5)
file.
Libhandy (libhandy-0.0-dev) is available in [PureOS][0] and Debian's
Libhandy (libhandy-1-dev) is available in [PureOS][0] and Debian's
[experimental distribution][1]. If you don't want to fetch it from there you
can [build it from souce][2].
......@@ -115,6 +115,6 @@ If you don't have an XMPP account yet and want to subscribe to a service then pl
- XEP-0313: Message Archive Management
- XEP-0363: HTTP File Upload
[0]: http://software.pureos.net/search_pkg?term=libhandy-0.0-dev
[1]: https://packages.debian.org/search?keywords=libhandy-0.0-dev
[0]: http://software.pureos.net/search_pkg?term=libhandy-1-dev
[1]: https://packages.debian.org/search?keywords=libhandy-1-dev
[2]: https://source.puri.sm/Librem5/libhandy
project('chatty', 'c', version: '0.1.17',
meson_version: '>= 0.41.0',
project(
'chatty', 'c', 'cpp',
version: '0.2.0',
meson_version: '>= 0.46.0',
)
i18n = import('i18n')
......
......@@ -10,6 +10,7 @@ fur
hu
it
ja
ko
la
pl
pt
......
This diff is collapsed.
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: purism-chatty\n"
"Report-Msgid-Bugs-To: https://source.puri.sm/Librem5/chatty/issues\n"
"POT-Creation-Date: 2020-08-17 15:25+0000\n"
"PO-Revision-Date: 2020-08-17 19:15+0300\n"
"POT-Creation-Date: 2020-11-12 15:25+0000\n"
"PO-Revision-Date: 2020-11-13 15:33+0200\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <trans-uk@lists.fedoraproject.org>\n"
"Language: uk\n"
......@@ -20,7 +20,7 @@ msgstr ""
"=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
#: data/sm.puri.Chatty.desktop.in:3 data/sm.puri.Chatty.metainfo.xml.in:6
#: src/chatty-application.c:304 src/ui/chatty-window.ui:224
#: src/chatty-application.c:304 src/ui/chatty-window.ui:225
msgid "Chats"
msgstr "Спілкування"
......@@ -224,77 +224,66 @@ msgstr "і оператор може стягувати за нього спла
#. Translators: Timestamp seconds suffix
#: src/chatty-list-row.c:73
#| msgid "s"
msgctxt "timestamp-suffix-seconds"
msgid "s"
msgstr "с"
#. Translators: Timestamp minute suffix
#: src/chatty-list-row.c:75
#| msgid "m"
msgctxt "timestamp-suffix-minute"
msgid "m"
msgstr "хв"
#. Translators: Timestamp minutes suffix
#: src/chatty-list-row.c:77
#| msgid "m"
msgctxt "timestamp-suffix-minutes"
msgid "m"
msgstr "хв"
#. Translators: Timestamp hour suffix
#: src/chatty-list-row.c:79
#| msgid "h"
msgctxt "timestamp-suffix-hour"
msgid "h"
msgstr "г"
#. Translators: Timestamp hours suffix
#: src/chatty-list-row.c:81
#| msgid "h"
msgctxt "timestamp-suffix-hours"
msgid "h"
msgstr "г"
#. Translators: Timestamp day suffix
#: src/chatty-list-row.c:83
#| msgid "d"
msgctxt "timestamp-suffix-day"
msgid "d"
msgstr "д"
#. Translators: Timestamp days suffix
#: src/chatty-list-row.c:85
#| msgid "d"
msgctxt "timestamp-suffix-days"
msgid "d"
msgstr "д"
#. Translators: Timestamp month suffix
#: src/chatty-list-row.c:87
#| msgid "mo"
msgctxt "timestamp-suffix-month"
msgid "mo"
msgstr "м"
#. Translators: Timestamp months suffix
#: src/chatty-list-row.c:89
#| msgid "mos"
msgctxt "timestamp-suffix-months"
msgid "mos"
msgstr "міс"
#. Translators: Timestamp year suffix
#: src/chatty-list-row.c:91
#| msgid "y"
msgctxt "timestamp-suffix-year"
msgid "y"
msgstr "р"
#. Translators: Timestamp years suffix
#: src/chatty-list-row.c:93
#| msgid "y"
msgctxt "timestamp-suffix-years"
msgid "y"
msgstr "р"
......@@ -321,32 +310,32 @@ msgstr "Модератор"
msgid "Member"
msgstr "Член"
#: src/chatty-manager.c:879
#: src/chatty-manager.c:899
#, c-format
msgid "New message from %s"
msgstr "Нове повідомлення від %s"
#: src/chatty-message-row.c:89
#: src/chatty-message-row.c:94
msgid "Copy"
msgstr "Копіювати"
#: src/chatty-notify.c:68
#: src/chatty-notify.c:67
msgid "Open Message"
msgstr "Відкрити повідомлення"
#: src/chatty-notify.c:73
#: src/chatty-notify.c:72
msgid "Message Received"
msgstr "Надійшло повідомлення"
#: src/chatty-notify.c:79
#: src/chatty-notify.c:78
msgid "Message Error"
msgstr "Помилка повідомлення"
#: src/chatty-notify.c:85
#: src/chatty-notify.c:84
msgid "Account Info"
msgstr "Дані щодо облікового запису"
#: src/chatty-notify.c:91
#: src/chatty-notify.c:90
msgid "Account Connected"
msgstr "Обліковий запис з'єднано"
......@@ -362,8 +351,8 @@ msgstr "Зберегти файл…"
msgid "Open File..."
msgstr "Відкрити файл…"
#: src/chatty-purple-request.c:191 src/chatty-window.c:609
#: src/dialogs/chatty-settings-dialog.c:447
#: src/chatty-purple-request.c:191 src/chatty-window.c:600
#: src/dialogs/chatty-settings-dialog.c:443
#: src/dialogs/chatty-user-info-dialog.c:66 src/ui/chatty-dialog-join-muc.ui:16
#: src/ui/chatty-dialog-muc-info.ui:56
msgid "Cancel"
......@@ -373,7 +362,7 @@ msgstr "Скасувати"
msgid "Save"
msgstr "Зберегти"
#: src/chatty-purple-request.c:193 src/dialogs/chatty-settings-dialog.c:446
#: src/chatty-purple-request.c:193 src/dialogs/chatty-settings-dialog.c:442
#: src/dialogs/chatty-user-info-dialog.c:65
msgid "Open"
msgstr "Відкрити"
......@@ -381,22 +370,21 @@ msgstr "Відкрити"
#. TRANSLATORS: Timestamp from the last week with 24 hour time, e.g. “Tuesday 18∶42”.
#. See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format
#.
#: src/chatty-utils.c:298
#: src/chatty-utils.c:299
msgid "%A %H∶%M"
msgstr "%a %H∶%M"
#. TRANSLATORS: Timestamp from the last week with 12 hour time, e.g. “Tuesday 06∶42 PM”.
#. See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format
#.
#: src/chatty-utils.c:303
#| msgid "%A %I:%M %p"
#: src/chatty-utils.c:304
msgid "%A %I∶%M %p"
msgstr "%a %I∶%M %p"
#. TRANSLATORS: Timestamp from more than 7 days ago, e.g. “2020-08-11”.
#. See https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format
#.
#: src/chatty-utils.c:310
#: src/chatty-utils.c:311
msgid "%Y-%m-%d"
msgstr "%d-%m-%Y"
......@@ -437,31 +425,31 @@ msgstr ""
msgid "Start chatting"
msgstr "Почати спілкування"
#: src/chatty-window.c:592
msgid "Disconnect group chat"
msgstr "Від'єднатися від групового спілкування"
#: src/chatty-window.c:593
msgid "This removes chat from chats list"
msgstr "У результаті спілкування буде вилучено зі списку спілкувань"
#: src/chatty-window.c:597
#: src/chatty-window.c:585
msgid "Delete chat with"
msgstr "Вилучити спілкування з"
#: src/chatty-window.c:598
#: src/chatty-window.c:586
msgid "This deletes the conversation history"
msgstr "У результаті буде вилучено журнал спілкування"
#: src/chatty-window.c:611
#: src/chatty-window.c:588
msgid "Disconnect group chat"
msgstr "Від'єднатися від групового спілкування"
#: src/chatty-window.c:589
msgid "This removes chat from chats list"
msgstr "У результаті спілкування буде вилучено зі списку спілкувань"
#: src/chatty-window.c:602
msgid "Delete"
msgstr "Вилучити"
#: src/chatty-window.c:839
#: src/chatty-window.c:812
msgid "An SMS and XMPP messaging client"
msgstr "Клієнт обміну повідомленнями SMS і XMPP"
#: src/chatty-window.c:846
#: src/chatty-window.c:819
msgid "translator-credits"
msgstr "Юрій Чорноіван <yurchor@ukr.net>, 2020"
......@@ -469,11 +457,11 @@ msgstr "Юрій Чорноіван <yurchor@ukr.net>, 2020"
msgid "members"
msgstr "учасники"
#: src/dialogs/chatty-new-chat-dialog.c:134
#: src/dialogs/chatty-new-chat-dialog.c:152
msgid "Send To"
msgstr "Надіслати"
#: src/dialogs/chatty-new-chat-dialog.c:178
#: src/dialogs/chatty-new-chat-dialog.c:196
#, c-format
msgid "Error opening GNOME Contacts: %s"
msgstr "Помилка під час спроби відкрити «Контакти» GNOME: %s"
......@@ -498,17 +486,17 @@ msgstr "З'єднання…"
msgid "disconnected"
msgstr "від'єднано"
#: src/dialogs/chatty-settings-dialog.c:443
#: src/dialogs/chatty-settings-dialog.c:439
#: src/dialogs/chatty-user-info-dialog.c:62
msgid "Set Avatar"
msgstr "Встановити аватар"
#: src/dialogs/chatty-settings-dialog.c:513
#: src/dialogs/chatty-settings-dialog.c:509
#: src/ui/chatty-settings-dialog.ui:477
msgid "Delete Account"
msgstr "Вилучити запис"
#: src/dialogs/chatty-settings-dialog.c:516
#: src/dialogs/chatty-settings-dialog.c:512
#, c-format
msgid "Delete account %s?"
msgstr "Вилучити запис %s?"
......@@ -541,7 +529,7 @@ msgstr "Нове групове спілкування"
msgid "Join Chat"
msgstr "Долучитися до спілкування"
#: src/ui/chatty-dialog-join-muc.ui:81 src/ui/chatty-dialog-new-chat.ui:237
#: src/ui/chatty-dialog-join-muc.ui:81 src/ui/chatty-dialog-new-chat.ui:298
msgid "Select chat account"
msgstr "Виберіть обліковий запис"
......@@ -601,7 +589,7 @@ msgstr "Почати спілкування"
msgid "New Contact"
msgstr "Створити контакт"
#: src/ui/chatty-dialog-new-chat.ui:83 src/ui/chatty-window.ui:125
#: src/ui/chatty-dialog-new-chat.ui:83 src/ui/chatty-window.ui:126
msgid "Add Contact"
msgstr "Додати контакт"
......@@ -609,15 +597,25 @@ msgstr "Додати контакт"
msgid "Send To:"
msgstr "Надіслати:"
#: src/ui/chatty-dialog-new-chat.ui:288
#: src/ui/chatty-dialog-new-chat.ui:225
msgid "No Search Results"
msgstr "Нічого не знайдено"
#: src/ui/chatty-dialog-new-chat.ui:238
msgid "Try different search, or type a valid number to create new chat"
msgstr ""
"Спробуйте інший критерій пошуку або введіть коректне число, щоб розпочати"
" нове спілкування"
#: src/ui/chatty-dialog-new-chat.ui:349
msgid "Name (optional)"
msgstr "Назва (необов’язково):"
#: src/ui/chatty-dialog-new-chat.ui:328 src/ui/chatty-window.ui:151
#: src/ui/chatty-dialog-new-chat.ui:389 src/ui/chatty-window.ui:152
msgid "Add to Contacts"
msgstr "Додати до контактів"
#: src/ui/chatty-dialog-user-info.ui:12 src/ui/chatty-window.ui:111
#: src/ui/chatty-dialog-user-info.ui:12 src/ui/chatty-window.ui:112
msgid "Chat Details"
msgstr "Параметри спілкування"
......@@ -785,34 +783,34 @@ msgstr "Провайдер"
msgid "About Chats"
msgstr "Про «Спілкування»"
#: src/ui/chatty-window.ui:58
#: src/ui/chatty-window.ui:59
msgid "New Message…"
msgstr "Нове повідомлення…"
#: src/ui/chatty-window.ui:71
#: src/ui/chatty-window.ui:72
msgid "New Group Message…"
msgstr "Нове групове повідомлення…"
#: src/ui/chatty-window.ui:84
#: src/ui/chatty-window.ui:85
msgid "New Bulk SMS…"
msgstr "Нове пакетне SMS…"
#: src/ui/chatty-window.ui:176
#: src/ui/chatty-window.ui:177
msgid "Leave Chat"
msgstr "Полишити спілкування"
#: src/ui/chatty-window.ui:189
#: src/ui/chatty-window.ui:190
msgid "Delete Chat"
msgstr "Вилучити спілкування"
#: src/users/chatty-contact.c:313
#: src/users/chatty-contact.c:315
msgid "Mobile: "
msgstr "Мобільний: "
#: src/users/chatty-contact.c:315
#: src/users/chatty-contact.c:317
msgid "Work: "
msgstr "Робочий: "
#: src/users/chatty-contact.c:317
#: src/users/chatty-contact.c:319
msgid "Other: "
msgstr "Інший: "
......@@ -24,6 +24,7 @@
#define G_LOG_DOMAIN "chatty-application"
#include <glib/gi18n.h>
#include <handy.h>
#include "chatty-config.h"
#include "chatty-window.h"
......@@ -301,6 +302,8 @@ chatty_application_startup (GApplication *application)
G_APPLICATION_CLASS (chatty_application_parent_class)->startup (application);
hdy_init ();
g_set_application_name (_("Chats"));
lfb_init (CHATTY_APP_ID, NULL);
......@@ -311,7 +314,7 @@ chatty_application_startup (GApplication *application)
self->css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (self->css_provider,
"/sm/puri/chatty/css/style.css");
"/sm/puri/Chatty/css/style.css");
g_action_map_add_action_entries (G_ACTION_MAP (self), app_entries,
G_N_ELEMENTS (app_entries), self);
......
......@@ -366,16 +366,12 @@ chat_view_message_row_new (ChattyMessage *message,
{
GtkWidget *row;
ChattyProtocol protocol;
gboolean is_im = TRUE;
g_assert (CHATTY_IS_MESSAGE (message));
g_assert (CHATTY_IS_CHAT_VIEW (self));
if (self->message_type == CHATTY_MSG_TYPE_MUC)
is_im = FALSE;
protocol = chatty_item_get_protocols (CHATTY_ITEM (self->chat));
row = chatty_message_row_new (message, protocol, is_im);
row = chatty_message_row_new (message, protocol, chatty_chat_is_im (self->chat));
chatty_message_row_set_alias (CHATTY_MESSAGE_ROW (row),
chatty_message_get_user_alias (message));
......@@ -703,7 +699,8 @@ chat_view_send_message_button_clicked_cb (ChattyChatView *self)
}
if (protocol == CHATTY_PROTOCOL_MATRIX ||
protocol == CHATTY_PROTOCOL_XMPP)
protocol == CHATTY_PROTOCOL_XMPP ||
protocol == CHATTY_PROTOCOL_TELEGRAM)
escaped = purple_markup_escape_text (message, -1);
if (conv && purple_conversation_get_type (conv) == PURPLE_CONV_TYPE_IM) {
......@@ -893,7 +890,7 @@ chatty_chat_view_class_init (ChattyChatViewClass *klass)
widget_class->map = chatty_chat_view_map;
gtk_widget_class_set_template_from_resource (widget_class,
"/sm/puri/chatty/"
"/sm/puri/Chatty/"
"ui/chatty-chat-view.ui");
gtk_widget_class_bind_template_child (widget_class, ChattyChatView, message_list);
......
......@@ -24,6 +24,22 @@ typedef enum
CHATTY_CONNECTED,
} ChattyStatus;
/**
* ChattyIdType:
*
* The type of ID used. This can be different
* from protocol. Say, a user may use a phone
* number to log in to a matrix account.
*/
typedef enum
{
CHATTY_ID_UNKNOWN,
CHATTY_ID_PHONE,
CHATTY_ID_EMAIL,
CHATTY_ID_MATRIX,
CHATTY_ID_XMPP
} ChattyIdType;
/**
* ChattyProtocol:
*
......@@ -100,3 +116,17 @@ typedef enum
CHATTY_STATUS_SENDING_FAILED,
CHATTY_STATUS_DELIVERY_FAILED
} ChattyMsgStatus;
typedef enum
{
CHATTY_MESSAGE_UNKNOWN,
CHATTY_MESSAGE_TEXT,
CHATTY_MESSAGE_HTML,
CHATTY_MESSAGE_HTML_ESCAPED,
CHATTY_MESSAGE_MATRIX_HTML,
CHATTY_MESSAGE_LOCATION,
CHATTY_MESSAGE_FILE,
CHATTY_MESSAGE_IMAGE,
CHATTY_MESSAGE_VIDEO,
chatty_message_AUDIO,
} ChattyMsgType;
This diff is collapsed.
......@@ -78,13 +78,7 @@ gboolean chatty_history_im_exists (const char *accoun
const char *who);
gboolean chatty_history_chat_exists (const char *account,
const char *room);
gboolean chatty_history_add_message (const char *account,
const char *room,
const char *who,
const char *message,
char **uid,
PurpleMessageFlags flags,
time_t time_stamp,
PurpleConversationType type);
gboolean chatty_history_add_message (ChattyChat *chat,
ChattyMessage *message);
G_END_DECLS
......@@ -328,7 +328,7 @@ chatty_list_row_class_init (ChattyListRowClass *klass)
object_class->finalize = chatty_list_row_finalize;
gtk_widget_class_set_template_from_resource (widget_class,
"/sm/puri/chatty/"
"/sm/puri/Chatty/"
"ui/chatty-list-row.ui");
gtk_widget_class_bind_template_child (widget_class, ChattyListRow, avatar);
gtk_widget_class_bind_template_child (widget_class, ChattyListRow, title);
......
......@@ -111,6 +111,8 @@ static GHashTable *ui_info = NULL;
#define PURPLE_GLIB_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR)
#define PURPLE_GLIB_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)
static void manager_update_protocols (ChattyManager *self);
static int
manager_sort_chat_item (ChattyChat *a,
ChattyChat *b,
......@@ -209,8 +211,10 @@ manager_load_messages_cb (GObject *object,
model = chatty_chat_get_messages (item);
/* If at least one message is loaded, don’t add again. */
if (g_list_model_get_n_items (model) == 0)
if (g_list_model_get_n_items (model) == 0) {
chatty_pp_chat_prepend_messages (CHATTY_PP_CHAT (item), messages);
manager_update_protocols (self);
}
}
} else if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
......@@ -832,7 +836,21 @@ chatty_conv_write_conversation (PurpleConversation *conv,
pcm.who = chatty_utils_jabber_id_strip(who);
} else {
pcm.who = chatty_pp_chat_get_buddy_name (CHATTY_PP_CHAT (chat), who);
ChattyProtocol protocol;
protocol = chatty_item_get_protocols (CHATTY_ITEM (chat));
if (protocol == CHATTY_PROTOCOL_MATRIX ||
protocol == CHATTY_PROTOCOL_XMPP)
pcm.who = chatty_pp_chat_get_buddy_name (CHATTY_PP_CHAT (chat), who);
else
pcm.who = g_strdup (who);
if (protocol == CHATTY_PROTOCOL_XMPP &&
!g_str_has_prefix (pcm.who, conv->name)) {
g_autofree char *temp = pcm.who;
pcm.who = chatty_utils_jabber_id_strip (pcm.who);
}
}
// No reason to go further if we ignore system/status
......@@ -851,27 +869,12 @@ chatty_conv_write_conversation (PurpleConversation *conv,
// If anyone wants to suppress archiving - feel free to set NO_LOG flag
purple_signal_emit (chatty_manager_get_default (),
"conversation-write", account, &pcm, &uuid, type);
"conversation-write", conv, &pcm, &uuid, type);
g_debug("Posting message id:%s flags:%d type:%d from:%s",
uuid, pcm.flags, type, pcm.who);
/*
* This is default fallback history handler. Other plugins may
* intercept “conversation-write” and suppress it if they handle
* history on their own (eg. MAM). If %PURPLE_MESSAGE_NO_LOG is
* set in @flags, it won't be saved to database.
*/
if (!(pcm.flags & PURPLE_MESSAGE_NO_LOG)) {
const char *chat_name;
chat_name = pcm.who;
if (chatty_chat_is_im (chat))
chat_name = chatty_chat_get_chat_name (chat);
chatty_history_add_message (account->username, pcm.alias, chat_name,
pcm.what, &uuid, pcm.flags, pcm.when, type);
}
if (!uuid)
uuid = g_uuid_string_random ();
if (*message != '\0') {
......@@ -923,10 +926,32 @@ chatty_conv_write_conversation (PurpleConversation *conv,
chatty_pp_chat_append_message (CHATTY_PP_CHAT (chat), chat_message);
}
if (chat_message && pcm.who && !(flags & PURPLE_MESSAGE_SEND))
chatty_message_set_user_name (chat_message, pcm.who);
/*
* This is default fallback history handler. Other plugins may
* intercept “conversation-write” and suppress it if they handle
* history on their own (eg. MAM). If %PURPLE_MESSAGE_NO_LOG is
* set in @flags, it won't be saved to database.
*/
if (!(pcm.flags & PURPLE_MESSAGE_NO_LOG) && chat_message)
chatty_history_add_message (chat, chat_message);
chatty_chat_set_unread_count (chat, chatty_chat_get_unread_count (chat) + 1);
gtk_sorter_changed (self->chat_sorter, GTK_SORTER_ORDER_TOTAL);
}
if (chat) {
GListModel *messages;
messages = chatty_chat_get_messages (chat);
/* The first message was added, notify so that chat list in main window updates */
if (g_list_model_get_n_items (messages) == 1)
manager_update_protocols (self);
}
g_free (pcm.who);
g_free (pcm.what);
g_free (pcm.alias);
......@@ -1073,6 +1098,7 @@ manager_buddy_added_cb (PurpleBuddy *pp_buddy,
ChattyManager *self)
{
g_autoptr(ChattyChat) chat = NULL;
PurpleConversation *conv;
ChattyPpAccount *account;
ChattyPpBuddy *buddy;
ChattyContact *contact;
......@@ -1096,7 +1122,19 @@ manager_buddy_added_cb (PurpleBuddy *pp_buddy,
contact = chatty_eds_find_by_number (self->chatty_eds, id);
chatty_pp_buddy_set_contact (buddy, contact);