Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/telegram-purple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormjentsch <mtthsjntsch@gmail.com>2015-10-11 15:17:24 +0300
committermjentsch <mtthsjntsch@gmail.com>2015-10-11 15:17:24 +0300
commit4eeb7f73c9bdff4fc3eac31ac6d5d7e720c96b9d (patch)
treeee8932b8d94c921940ee115b6b09dd525907473b /tgp-blist.h
parent7f3cf7c58fd5d133b0d1fde1111d6513682b8ce2 (diff)
Overhaul username handling
Use print names instead of ids as usernames, to fix problems with "useless" user ids showing up for unknown users and in group chats. Remove workarounds like "Telegram Foreign" needed to temporarily store user names for alias resolution.
Diffstat (limited to 'tgp-blist.h')
-rw-r--r--tgp-blist.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/tgp-blist.h b/tgp-blist.h
new file mode 100644
index 0000000..b00d1a6
--- /dev/null
+++ b/tgp-blist.h
@@ -0,0 +1,43 @@
+/*
+ This file is part of telegram-purple
+
+ 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 program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+
+ Copyright Matthias Jentsch 2015
+ */
+
+#ifndef tgp_blist_h
+#define tgp_blist_h
+
+#include <tgl.h>
+#include <purple.h>
+
+#define TGP_BUDDY_KEY_PEER_ID "user_id"
+#define TGP_BUDDY_KEY_PEER_TYPE "peer_type"
+
+tgl_peer_t *tgp_blist_peer_get (struct tgl_state *TLS, tgl_peer_id_t id);
+const char *tgp_blist_peer_get_name (struct tgl_state *TLS, tgl_peer_id_t id);
+int tgp_blist_peer_exists (struct tgl_state *TLS, tgl_peer_id_t id);
+
+void tgp_blist_buddy_set_id (PurpleBuddy *buddy, tgl_peer_id_t id);
+tgl_peer_id_t tgp_blist_buddy_get_id (PurpleBuddy *buddy);
+PurpleBuddy *tgp_blist_buddy_new (struct tgl_state *TLS, tgl_peer_t *user);
+void tgp_blist_buddy_update_name (struct tgl_state *TLS, PurpleBuddy *buddy, struct tgl_user *user);
+PurpleBuddy *tgp_blist_buddy_find (struct tgl_state *TLS, tgl_peer_id_t user);
+PurpleChat *tgp_blist_chat_find (struct tgl_state *TLS, tgl_peer_id_t user);
+void tgp_blist_peer_add (struct tgl_state *TLS, tgl_peer_t *peer);
+PurpleGroup *tgp_blist_group_init (const char *name);
+
+#endif