summaryrefslogtreecommitdiffstats
path: root/src/h.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/h.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/h.c b/src/h.c
index 8713d9d..8067c5b 100644
--- a/src/h.c
+++ b/src/h.c
@@ -26,6 +26,7 @@
#else
#define DC_IF_UI_GTK(...)
#endif
+#define DC_PAIP (pass->api_io.program)
/* it's strongly recommended to calloc structs during initialization. */
enum dc_status { /* theese are flags and should be and-checked */
DC_UNSET = 0, /* default value when enum is calloced */ /* \/ USEFUL FOR ->next!!! */
@@ -431,9 +432,9 @@ struct dc_guild {
char * name; /* yesfree */
char * description; /* yesfree */
unsigned long long int id; /* 0 for virtual DMs guild */
- struct dc_channel * channel; /* nofree - first channel */
struct dc_role * role; /* nofree - first role. NOTE: role->id==guild->id => @everyone */
enum dc_status status; /* /\ if NULL then assume all permissions - a DM guild */
+ DC_ISASQ(channel); /* yesfree array only - can't be LL because of DM channels in many g[0] */
#ifdef DC_UI_GTK
GtkTreeIter iter; /* GtkTreeModel needs GTK_TREE_MODEL_ITERS_PERSIST for this to work */
gboolean is_iter; /* see parag 8 file:///usr/share/doc/libgtk-3-doc/gtk3/GtkTreeModel.html */
@@ -448,6 +449,7 @@ void dc_guild_free (struct dc_guild * s, enum dc_status t) {
return;
free(s->name);
free(s->description);
+ free(s->channels);
if (!(t & DC_REPLACE)) /* we do this because we want to keep the pointer intact sometimes and */
free(s); /* reused; for example when replacing/updating structs */
}
@@ -490,10 +492,9 @@ struct dc_channel {
DC_STRUCT_PREFIX
char * name; /* yesfree - name */
char * topic; /* yesfree - topic */
- unsigned long long int id;
- enum dc_channel_type type;
- struct dc_guild * guild; /* nofree */
- struct dc_channel * next; /* nofree - next channel (linked list of all channel of dc_guild) */
+ unsigned long long int id; /* send message functions must therefore take */
+ enum dc_channel_type type; /* vvv client as parameter to get g[0] */
+ struct dc_guild * guild; /* nofree - in case of DM channel this is NULL, many g[0] same ch */
struct dc_message * message; /* nofree - first message (ordered by time) */
enum dc_status status;
DC_ISASQ(permission); /* yesfree array and members - ch permissions for users/roles */
@@ -817,7 +818,6 @@ void dc_transfer_channel (struct dc_channel * n, struct dc_channel * o) { /* n w
DC_TRANSFER_MEMBER(id)
DC_TRANSFER_MEMBER(type)
DC_TRANSFER_MEMBER(guild)
- DC_TRANSFER_MEMBER(next)
DC_TRANSFER_MEMBER(message)
DC_TRANSFER_ISA(permission)
DC_TRANSFER_ISA(user)
@@ -831,9 +831,9 @@ void dc_transfer_guild (struct dc_guild * n, struct dc_guild * o) {
DC_TRANSFER_MEMBER(name)
DC_TRANSFER_MEMBER(description)
DC_TRANSFER_MEMBER(id)
- DC_TRANSFER_MEMBER(channel)
DC_TRANSFER_MEMBER(role)
DC_TRANSFER_MEMBER(status)
+ DC_TRANSFER_ISA(channel)
DC_IF_UI_GTK(
memmove(&n->iter, &o->iter, sizeof(GtkTreeIter));
n->is_iter = o->is_iter;
@@ -873,7 +873,6 @@ void dc_transfer_user (struct dc_user * n, struct dc_user * o) {
}
DC_GEN_X(user, USER)
DC_GEN_X(channel, CHANNEL)
-DC_FIND_LL_X(channel)
DC_GEN_X(guild, GUILD)
DC_GEN_X(role, ROLE)
DC_FIND_LL_X(role)