# HG changeset patch # User franky # Date 1557653550 -7200 # Node ID ffd0e57e95634822216065c5b4c2ca37c7aabd26 # Parent 0dc317b5599dcd7f743e4e8468fd5f86146a6503 Defined types shall end with "_t" diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/CodingStyle.txt --- a/mcabber/CodingStyle.txt Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/CodingStyle.txt Sun May 12 11:32:30 2019 +0200 @@ -8,6 +8,7 @@ - Avoid lines longer than 80 characters; - Indentation is 2 spaces (ok, maybe it isn't a good idea but it's the current style); +- Defined types shall end with _t - Put a space after non-functions statements (e.g. if, while...) - Put the opening brace last on the same line, and put the closing brace first except for functions, where the opening brace should be alone on a new line. diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/caps.c --- a/mcabber/mcabber/caps.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/caps.c Sun May 12 11:32:30 2019 +0200 @@ -30,23 +30,23 @@ char *category; char *type; char *name; -} identity; +} identity_t; typedef struct { GHashTable *fields; -} dataform; +} dataform_t; typedef struct { GHashTable *identities; GHashTable *features; GHashTable *forms; -} caps; +} caps_t; static GHashTable *caps_cache = NULL; void caps_destroy(gpointer data) { - caps *c = data; + caps_t *c = data; g_hash_table_destroy(c->identities); g_hash_table_destroy(c->features); g_hash_table_destroy(c->forms); @@ -55,7 +55,7 @@ void identity_destroy(gpointer data) { - identity *i = data; + identity_t *i = data; g_free(i->category); g_free(i->type); g_free(i->name); @@ -64,7 +64,7 @@ void form_destroy(gpointer data) { - dataform *f = data; + dataform_t *f = data; g_hash_table_destroy(f->fields); g_free(f); } @@ -95,7 +95,7 @@ { if (!hash) return; - caps *c = g_new0(caps, 1); + caps_t *c = g_new0(caps_t, 1); c->features = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); c->identities = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, identity_destroy); c->forms = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, form_destroy); @@ -113,7 +113,7 @@ void caps_move_to_local(char *hash, char *bjid) { char *orig_hash; - caps *c = NULL; + caps_t *c = NULL; if (!hash || !bjid) return; g_hash_table_lookup_extended(caps_cache, hash, (gpointer*)&orig_hash, (gpointer*)&c); @@ -130,7 +130,7 @@ /*if bjid is NULL, it will check only verified hashes */ int caps_has_hash(const char *hash, const char *bjid) { - caps *c = NULL; + caps_t *c = NULL; if (!hash) return 0; c = g_hash_table_lookup(caps_cache, hash); @@ -148,7 +148,7 @@ const char *type, const char *lang) { - caps *c; + caps_t *c; if (!hash || !category || !type) return; if (!lang) @@ -156,7 +156,7 @@ c = g_hash_table_lookup(caps_cache, hash); if (c) { - identity *i = g_new0(identity, 1); + identity_t *i = g_new0(identity_t, 1); i->category = g_strdup(category); i->name = g_strdup(name); @@ -175,12 +175,12 @@ void caps_add_dataform(const char *hash, const char *formtype) { - caps *c; + caps_t *c; if (!formtype) return; c = g_hash_table_lookup(caps_cache, hash); if (c) { - dataform *d = g_new0(dataform, 1); + dataform_t *d = g_new0(dataform_t, 1); char *f = g_strdup(formtype); d->fields = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, field_destroy); @@ -196,12 +196,12 @@ void caps_add_dataform_field(const char *hash, const char *formtype, const char *field, const char *value) { - caps *c; + caps_t *c; if (!formtype || !field || !value) return; c = g_hash_table_lookup(caps_cache, hash); if (c) { - dataform *d; + dataform_t *d; d = g_hash_table_lookup(c->forms, formtype); if (d) { gpointer key, val; @@ -221,7 +221,7 @@ void caps_add_feature(const char *hash, const char *feature) { - caps *c; + caps_t *c; if (!hash || !feature) return; c = g_hash_table_lookup(caps_cache, hash); @@ -236,7 +236,7 @@ * then local storage for that jid will be checked */ int caps_has_feature(const char *hash, char *feature, char *bjid) { - caps *c = NULL; + caps_t *c = NULL; if (!hash || !feature) return 0; c = g_hash_table_lookup(caps_cache, hash); @@ -260,7 +260,7 @@ void caps_foreach_feature(const char *hash, GFunc func, gpointer user_data) { - caps *c; + caps_t *c; if (!hash) return; c = g_hash_table_lookup(caps_cache, hash); @@ -278,7 +278,7 @@ guint8 digest[20]; gsize digest_size = 20; gchar *hash, *old_hash = NULL; - caps *old_caps, *c; + caps_t *old_caps, *c; gpointer key; if (!g_hash_table_lookup_extended(caps_cache, "", &key, (gpointer *)&c)) @@ -292,7 +292,7 @@ langs = g_hash_table_get_keys(c->identities); langs = g_list_sort(langs, _strcmp_sort); { - identity *i; + identity_t *i; GList *lang; char *identity_S; for (lang=langs; lang; lang=lang->next) { @@ -336,7 +336,7 @@ gsize digest_size = 20; gchar *local_hash; gboolean match = FALSE; - caps *c = g_hash_table_lookup(caps_cache, hash); + caps_t *c = g_hash_table_lookup(caps_cache, hash); if (!g_strcmp0(function, "sha-1")) { checksum = g_checksum_new(G_CHECKSUM_SHA1); @@ -349,7 +349,7 @@ langs = g_hash_table_get_keys(c->identities); langs = g_list_sort(langs, _strcmp_sort); { - identity *i; + identity_t *i; GList *lang; char *identity_S; for (lang=langs; lang; lang=lang->next) { @@ -376,7 +376,7 @@ forms = g_hash_table_get_keys(c->forms); forms = g_list_sort(forms, _strcmp_sort); { - dataform *d; + dataform_t *d; GList *form, *fields; for (form=forms; form; form=form->next) { d = g_hash_table_lookup(c->forms, form->data); @@ -446,7 +446,7 @@ gchar *file; GList *features, *langs, *forms; GKeyFile *key_file; - caps *c; + caps_t *c; int fd; g_free (xml); @@ -470,7 +470,7 @@ langs = g_hash_table_get_keys (c->identities); { - identity *i; + identity_t *i; GList *lang; gchar *group; for (lang=langs; lang; lang=lang->next) { @@ -507,7 +507,7 @@ forms = g_hash_table_get_keys(c->forms); { - dataform *d; + dataform_t *d; GList *form, *fields; gchar *group; for (form=forms; form; form=form->next) { diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/compl.c --- a/mcabber/mcabber/compl.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/compl.c Sun May 12 11:32:30 2019 +0200 @@ -43,7 +43,7 @@ guint len_prefix; // length of text already typed by the user guint len_compl; // length of the last completion GList *next; // pointer to next completion to try -} compl; +} compl_t; typedef GSList *(*compl_handler_t) (void); // XXX userdata? *dynlist? @@ -52,7 +52,7 @@ guint flags; GSList *words; compl_handler_t dynamic; -} category; +} category_t; #define COMPL_CAT_BUILTIN 0x01 #define COMPL_CAT_ACTIVE 0x02 @@ -62,8 +62,8 @@ #define COMPL_CAT_USERFLAGS 0x30 -static compl *InputCompl; -static category *Categories; +static compl_t *InputCompl; +static category_t *Categories; static guint num_categories; // Dynamic completions callbacks @@ -107,7 +107,7 @@ #ifdef MODULES_ENABLE num_categories = ((num_categories / 16) + 1) * 16; #endif - Categories = g_new0(category, num_categories); + Categories = g_new0(category_t, num_categories); // Builtin completion categories: register_builtin_cat(COMPL_CMD, NULL); @@ -154,7 +154,7 @@ return 0; } num_categories += 16; - Categories = g_renew(category, Categories, num_categories); + Categories = g_renew(category_t, Categories, num_categories); for (j = i+1; j < num_categories; j++) Categories[j].flags = 0; } @@ -202,7 +202,7 @@ // Returns the number of possible completions. guint new_completion(const char *prefix, GSList *compl_cat, const gchar *suffix) { - compl *c; + compl_t *c; guint ret_len = 0; GSList *sl_cat; gint (*cmp)(const char *s1, const char *s2, size_t n); @@ -219,7 +219,7 @@ else cmp = &strncmp; - c = g_new0(compl, 1); + c = g_new0(compl_t, 1); // Build the list of matches for (sl_cat = compl_cat; sl_cat; sl_cat = g_slist_next(sl_cat)) { char *word = sl_cat->data; @@ -268,7 +268,7 @@ // Returns pointer to text to insert, NULL if no completion. const char *complete(gboolean fwd) { - compl* c = InputCompl; + compl_t *c = InputCompl; char *r; if (!InputCompl) return NULL; diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/hbuf.c --- a/mcabber/mcabber/hbuf.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/hbuf.c Sun May 12 11:32:30 2019 +0200 @@ -44,7 +44,7 @@ guint flags; gpointer xep184; } prefix; -} hbuf_block; +} hbuf_block_t; // do_wrap(p_hbuf, first_hbuf_elt, width) @@ -61,7 +61,7 @@ // - If there are '\n' in the string // - If length > width (and width != 0) while (curr_elt) { - hbuf_block *hbuf_b_curr, *hbuf_b_prev; + hbuf_block_t *hbuf_b_curr, *hbuf_b_prev; char *c, *end; char *br = NULL; // break pointer char *cr = NULL; // CR pointer @@ -69,7 +69,7 @@ // We want to break where we can find a space char or a CR - hbuf_b_curr = (hbuf_block*)(curr_elt->data); + hbuf_b_curr = (hbuf_block_t*)(curr_elt->data); hbuf_b_prev = hbuf_b_curr; c = hbuf_b_curr->ptr; @@ -93,7 +93,7 @@ end = hbuf_b_curr->ptr_end; hbuf_b_curr->ptr_end = br; // Create another block - hbuf_b_curr = g_new0(hbuf_block, 1); + hbuf_b_curr = g_new0(hbuf_block_t, 1); // The block must be persistent after a CR if (cr) { hbuf_b_curr->ptr = hbuf_b_prev->ptr_end + 1; // == cr+1 @@ -127,7 +127,7 @@ GList *curr_elt; char *line; guint hbb_blocksize, textlen; - hbuf_block *hbuf_block_elt; + hbuf_block_t *hbuf_block_elt; if (!text) return; @@ -136,7 +136,7 @@ textlen = strlen(text); hbb_blocksize = MAX(textlen+1, HBB_BLOCKSIZE); - hbuf_block_elt = g_new0(hbuf_block, 1); + hbuf_block_elt = g_new0(hbuf_block_t, 1); hbuf_block_elt->prefix.timestamp = timestamp; hbuf_block_elt->prefix.flags = prefix_flags; hbuf_block_elt->prefix.mucnicklen = mucnicklen; @@ -150,7 +150,7 @@ hbuf_block_elt->flags = HBB_FLAG_ALLOC | HBB_FLAG_PERSISTENT; hbuf_block_elt->ptr_end_alloc = hbuf_block_elt->ptr + hbb_blocksize; } else { - hbuf_block *hbuf_b_prev; + hbuf_block_t *hbuf_b_prev; // Set p_hbuf to the end of the list, to speed up history loading // (or CPU time will be used by g_list_last() for each line) *p_hbuf = g_list_last(*p_hbuf); @@ -172,7 +172,7 @@ // XXX We should check the return value. } else { GList *hbuf_head, *hbuf_elt; - hbuf_block *hbuf_b_elt; + hbuf_block_t *hbuf_b_elt; guint n = 0; hbuf_head = g_list_first(*p_hbuf); // We need at least 2 allocated blocks @@ -180,7 +180,7 @@ maxhbufblocks = 2; // Let's count the number of allocated areas for (hbuf_elt = hbuf_head; hbuf_elt; hbuf_elt = g_list_next(hbuf_elt)) { - hbuf_b_elt = (hbuf_block*)(hbuf_elt->data); + hbuf_b_elt = (hbuf_block_t*)(hbuf_elt->data); if (hbuf_b_elt->flags & HBB_FLAG_ALLOC) n++; } @@ -195,7 +195,7 @@ while (n >= maxhbufblocks) { int start_of_block = 1; for (hbuf_elt = hbuf_head; hbuf_elt; hbuf_elt = hbuf_head) { - hbuf_b_elt = (hbuf_block*)(hbuf_elt->data); + hbuf_b_elt = (hbuf_block_t*)(hbuf_elt->data); if (hbuf_b_elt->flags & HBB_FLAG_ALLOC) { if (start_of_block-- == 0) break; @@ -234,12 +234,12 @@ // Destroys all hbuf list. void hbuf_free(GList **p_hbuf) { - hbuf_block *hbuf_b_elt; + hbuf_block_t *hbuf_b_elt; GList *hbuf_elt; GList *first_elt = g_list_first(*p_hbuf); for (hbuf_elt = first_elt; hbuf_elt; hbuf_elt = g_list_next(hbuf_elt)) { - hbuf_b_elt = (hbuf_block*)(hbuf_elt->data); + hbuf_b_elt = (hbuf_block_t*)(hbuf_elt->data); if (hbuf_b_elt->flags & HBB_FLAG_ALLOC) { g_free(hbuf_b_elt->ptr); } @@ -256,7 +256,7 @@ void hbuf_rebuild(GList **p_hbuf, unsigned int width) { GList *first_elt, *curr_elt, *next_elt; - hbuf_block *hbuf_b_curr, *hbuf_b_next; + hbuf_block_t *hbuf_b_curr, *hbuf_b_next; // *p_hbuf needs to be the head of the list first_elt = *p_hbuf = g_list_first(*p_hbuf); @@ -268,8 +268,8 @@ // Last element? if (!next_elt) break; - hbuf_b_curr = (hbuf_block*)(curr_elt->data); - hbuf_b_next = (hbuf_block*)(next_elt->data); + hbuf_b_curr = (hbuf_block_t*)(curr_elt->data); + hbuf_b_next = (hbuf_block_t*)(next_elt->data); // Is next line not-persistent? if (!(hbuf_b_next->flags & HBB_FLAG_PERSISTENT)) { hbuf_b_curr->ptr_end = hbuf_b_next->ptr_end; @@ -291,10 +291,10 @@ // line... GList *hbuf_previous_persistent(GList *l_line) { - hbuf_block *hbuf_b_elt; + hbuf_block_t *hbuf_b_elt; while (l_line) { - hbuf_b_elt = (hbuf_block*)l_line->data; + hbuf_b_elt = (hbuf_block_t*)l_line->data; if (hbuf_b_elt->flags & HBB_FLAG_PERSISTENT && (hbuf_b_elt->flags & ~HBB_PREFIX_READMARK)) return l_line; @@ -312,7 +312,7 @@ hbb_line **hbuf_get_lines(GList *hbuf, unsigned int n) { unsigned int i; - hbuf_block *blk; + hbuf_block_t *blk; guint last_persist_prefixflags = 0; GList *last_persist; // last persistent flags hbb_line **array, **array_elt; @@ -324,7 +324,7 @@ // somewhere in the message. last_persist = hbuf_previous_persistent(hbuf); while (last_persist) { - blk = (hbuf_block*)last_persist->data; + blk = (hbuf_block_t*)last_persist->data; if ((blk->flags & HBB_FLAG_PERSISTENT) && blk->prefix.flags) { // This can be either the beginning of the message, // or a persistent line with a readmark flag (or both). @@ -345,7 +345,7 @@ if (hbuf) { int maxlen; - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); maxlen = blk->ptr_end - blk->ptr; *array_elt = (hbb_line*)g_new(hbb_line, 1); (*array_elt)->timestamp = blk->prefix.timestamp; @@ -393,7 +393,7 @@ // Search starts at hbuf, and goes forward if direction == 1, backward if -1 GList *hbuf_search(GList *hbuf, int direction, const char *string) { - hbuf_block *blk; + hbuf_block_t *blk; for (;;) { if (direction > 0) @@ -403,7 +403,7 @@ if (!hbuf) break; - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); // XXX blk->ptr is (maybe) not really correct, because the match should // not be after ptr_end. We should check that... if (strcasestr(blk->ptr, string)) @@ -417,12 +417,12 @@ // Return a pointer to the first line after date t in the history buffer GList *hbuf_jump_date(GList *hbuf, time_t t) { - hbuf_block *blk; + hbuf_block_t *blk; hbuf = g_list_first(hbuf); for ( ; hbuf && g_list_next(hbuf); hbuf = g_list_next(hbuf)) { - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); if (blk->prefix.timestamp >= t) break; } @@ -446,12 +446,12 @@ // or NULL if no mark was found. GList *hbuf_jump_readmark(GList *hbuf) { - hbuf_block *blk; + hbuf_block_t *blk; GList *r = NULL; hbuf = g_list_last(hbuf); for ( ; hbuf; hbuf = g_list_previous(hbuf)) { - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); if (blk->prefix.flags & HBB_PREFIX_READMARK) return r; if ((blk->flags & HBB_FLAG_PERSISTENT) && @@ -466,7 +466,7 @@ // Save the buffer to a file. void hbuf_dump_to_file(GList *hbuf, const char *filename) { - hbuf_block *blk; + hbuf_block_t *blk; hbb_line line; guint last_persist_prefixflags = 0; guint prefixwidth; @@ -490,7 +490,7 @@ for (hbuf = g_list_first(hbuf); hbuf; hbuf = g_list_next(hbuf)) { int maxlen; - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); maxlen = blk->ptr_end - blk->ptr; memset(&line, 0, sizeof(line)); @@ -525,12 +525,12 @@ // Returns TRUE if it was found and removed, otherwise FALSE gboolean hbuf_remove_receipt(GList *hbuf, gconstpointer xep184) { - hbuf_block *blk; + hbuf_block_t *blk; hbuf = g_list_last(hbuf); for ( ; hbuf; hbuf = g_list_previous(hbuf)) { - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); if (!g_strcmp0(blk->prefix.xep184, xep184)) { g_free(blk->prefix.xep184); blk->prefix.xep184 = NULL; @@ -547,7 +547,7 @@ // if action is FALSE, remove a previous readmark flag. void hbuf_set_readmark(GList *hbuf, gboolean action) { - hbuf_block *blk; + hbuf_block_t *blk; if (!hbuf) return; @@ -555,7 +555,7 @@ if (action) { // Add a readmark flag - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); blk->prefix.flags |= HBB_PREFIX_READMARK; // Shift hbuf in order to remove previous flags @@ -566,7 +566,7 @@ // Remove old mark for ( ; hbuf; hbuf = g_list_previous(hbuf)) { - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); if (blk->prefix.flags & HBB_PREFIX_READMARK) { blk->prefix.flags &= ~HBB_PREFIX_READMARK; break; @@ -578,24 +578,24 @@ // Unset the buffer readmark if it is on the last line void hbuf_remove_trailing_readmark(GList *hbuf) { - hbuf_block *blk; + hbuf_block_t *blk; if (!hbuf) return; hbuf = g_list_last(hbuf); - blk = (hbuf_block*)(hbuf->data); + blk = (hbuf_block_t*)(hbuf->data); blk->prefix.flags &= ~HBB_PREFIX_READMARK; } // hbuf_get_blocks_number() -// Returns the number of allocated hbuf_block's. +// Returns the number of allocated hbuf_block_t's. guint hbuf_get_blocks_number(GList *hbuf) { - hbuf_block *hbuf_b_elt; + hbuf_block_t *hbuf_b_elt; guint count = 0U; for (hbuf = g_list_first(hbuf); hbuf; hbuf = g_list_next(hbuf)) { - hbuf_b_elt = (hbuf_block*)(hbuf->data); + hbuf_b_elt = (hbuf_block_t*)(hbuf->data); if (hbuf_b_elt->flags & HBB_FLAG_ALLOC) count++; } diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/main.c --- a/mcabber/mcabber/main.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/main.c Sun May 12 11:32:30 2019 +0200 @@ -355,7 +355,7 @@ static gboolean keyboard_activity(void) { - keycode kcode; + keycode_t kcode; if (terminate_ui) { return FALSE; diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/roster.c --- a/mcabber/mcabber/roster.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/roster.c Sun May 12 11:32:30 2019 +0200 @@ -79,9 +79,9 @@ #ifdef HAVE_GPGME struct pgp_data pgpdata; #endif -} res; +} res_t; -/* This is a private structure type for the roster */ +/* This is a private structure type for the roster_t */ typedef struct { gchar *name; @@ -89,7 +89,7 @@ guint type; enum subscr subscription; GSList *resource; - res *active_resource; + res_t *active_resource; /* For groupchats */ gchar *nickname; @@ -112,7 +112,7 @@ // list: user -> points to his group; group -> points to its users list GSList *list; -} roster; +} roster_t; /* ### Variables ### */ @@ -127,7 +127,7 @@ GList *alternate_buddy; GList *last_activity_buddy; -static roster roster_special; +static roster_t roster_special; static int unread_jid_del(const char *jid); @@ -145,7 +145,7 @@ /* ### Resources functions ### */ -static inline void free_resource_data(res *p_res) +static inline void free_resource_data(res_t *p_res) { if (!p_res) return; @@ -164,14 +164,14 @@ GSList *lip; for (lip = *reslist; lip ; lip = g_slist_next(lip)) - free_resource_data((res*)lip->data); + free_resource_data((res_t *)lip->data); // Free all nodes but the first (which is static) g_slist_free(*reslist); *reslist = NULL; } // Resources are sorted in ascending order -static gint resource_compare_prio(res *a, res *b) { +static gint resource_compare_prio(res_t *a, res_t *b) { if (a->prio < b->prio) return -1; else return 1; } @@ -184,10 +184,10 @@ // This could change in the future, because we should return the best one // (priority? last used? and fall back to the first resource) // -static res *get_resource(roster *rost, const char *resname) +static res_t *get_resource(roster_t *rost, const char *resname) { GSList *p; - res *r = NULL; + res_t *r = NULL; for (p = rost->resource; p; p = g_slist_next(p)) { r = p->data; @@ -206,15 +206,15 @@ // on this resource // - if not, add the resource, set the name, and return a pointer on this // new resource -static res *get_or_add_resource(roster *rost, const char *resname, gchar prio) +static res_t *get_or_add_resource(roster_t *rost, const char *resname, gchar prio) { GSList *p; - res *nres; + res_t *nres; if (!resname) return NULL; for (p = rost->resource; p; p = g_slist_next(p)) { - res *r = p->data; + res_t *r = p->data; if (!strcmp(r->name, resname)) { if (prio != r->prio) { r->prio = prio; @@ -226,7 +226,7 @@ } // Resource not found - nres = g_new0(res, 1); + nres = g_new0(res_t, 1); nres->name = g_strdup(resname); nres->prio = prio; rost->resource = g_slist_insert_sorted(rost->resource, nres, @@ -234,16 +234,16 @@ return nres; } -static void del_resource(roster *rost, const char *resname) +static void del_resource(roster_t *rost, const char *resname) { GSList *p; GSList *p_res_elt = NULL; - res *p_res; + res_t *p_res; if (!resname) return; for (p = rost->resource; p; p = g_slist_next(p)) { - res *r = p->data; + res_t *r = p->data; if (!strcmp(r->name, resname)) p_res_elt = p; } @@ -271,7 +271,7 @@ /* ### Roster functions ### */ -static inline void free_roster_user_data(roster *roster_usr) +static inline void free_roster_user_data(roster_t *roster_usr) { if (!roster_usr) return; @@ -286,21 +286,21 @@ } // Comparison function used to search in the roster (compares jids and types) -static gint roster_compare_jid_type(roster *a, roster *b) { +static gint roster_compare_jid_type(roster_t *a, roster_t *b) { if (! (a->type & b->type)) return -1; // arbitrary (but should be != 0, of course) return strcasecmp(a->jid, b->jid); } // Comparison function used to search in the roster (compares names and types) -static gint roster_compare_name_type(roster *a, roster *b) { +static gint roster_compare_name_type(roster_t *a, roster_t *b) { if (! (a->type & b->type)) return -1; // arbitrary (but should be != 0, of course) return strcmp(a->name, b->name); } // Comparison function used to sort the roster (by name) -static gint roster_compare_name(roster *a, roster *b) { +static gint roster_compare_name(roster_t *a, roster_t *b) { return strcmp(a->name, b->name); } @@ -311,7 +311,7 @@ { GSList *sl_roster_elt = groups; GSList *resource; - roster sample; + roster_t sample; GCompareFunc comp; if (!jidname) return NULL; @@ -331,7 +331,7 @@ return NULL; // Should not happen... while (sl_roster_elt) { - roster *roster_elt = (roster*)sl_roster_elt->data; + roster_t *roster_elt = (roster_t *)sl_roster_elt->data; if (roster_type & ROSTER_TYPE_GROUP) { if ((type == namesearch) && !strcmp(jidname, roster_elt->name)) return sl_roster_elt; @@ -346,14 +346,14 @@ // Returns pointer to new group, or existing group with that name GSList *roster_add_group(const char *name) { - roster *roster_grp; + roster_t *roster_grp; GSList *p_group; // #1 Check name doesn't already exist p_group = roster_find(name, namesearch, ROSTER_TYPE_GROUP); if (!p_group) { // #2 Create the group node - roster_grp = g_new0(roster, 1); + roster_grp = g_new0(roster_t, 1); roster_grp->name = g_strdup(name); roster_grp->type = ROSTER_TYPE_GROUP; // #3 Insert (sorted) @@ -365,7 +365,7 @@ } // Comparison function used to sort the unread list by ui (attn) priority -static gint _roster_compare_uiprio(roster *a, roster *b) { +static gint _roster_compare_uiprio(roster_t *a, roster_t *b) { return (b->ui_prio - a->ui_prio); } @@ -374,8 +374,8 @@ GSList *roster_add_user(const char *jid, const char *name, const char *group, guint type, enum subscr esub, gint onserver) { - roster *roster_usr; - roster *my_group; + roster_t *roster_usr; + roster_t *my_group; GSList *slist; if ((type != ROSTER_TYPE_USER) && @@ -400,7 +400,7 @@ if (name) buddy_setname(slist->data, (char*)name); // Let's check if the group name has changed - oldgroupname = ((roster*)((GSList*)roster_usr->list)->data)->name; + oldgroupname = ((roster_t *)((GSList*)roster_usr->list)->data)->name; if (group && strcmp(oldgroupname, group)) { buddy_setgroup(slist->data, (char*)group); // Note: buddy_setgroup() updates the user lists so we cannot @@ -412,9 +412,9 @@ // #2 add group if necessary slist = roster_add_group(group); if (!slist) return NULL; - my_group = (roster*)slist->data; + my_group = (roster_t *)slist->data; // #3 Create user node - roster_usr = g_new0(roster, 1); + roster_usr = g_new0(roster_t, 1); roster_usr->jid = g_strdup(jid); if (name) { roster_usr->name = g_strdup(name); @@ -448,14 +448,14 @@ { GSList *sl_user, *sl_group; GSList **sl_group_listptr; - roster *roster_usr; + roster_t *roster_usr; GSList *node; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_ROOM); if (sl_user == NULL) return; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; // Remove (if present) from unread messages list node = g_slist_find(unread_list, roster_usr); @@ -470,7 +470,7 @@ free_roster_user_data(roster_usr); // That's a little complex, we need to dereference twice - sl_group_listptr = &((roster*)(sl_group->data))->list; + sl_group_listptr = &((roster_t *)(sl_group->data))->list; *sl_group_listptr = g_slist_delete_link(*sl_group_listptr, sl_user); // We need to rebuild the list @@ -494,11 +494,11 @@ // Walk through groups while (sl_grp) { - roster *roster_grp = (roster*)sl_grp->data; + roster_t *roster_grp = (roster_t *)sl_grp->data; GSList *sl_usr = roster_grp->list; // Walk through this group users while (sl_usr) { - roster *roster_usr = (roster*)sl_usr->data; + roster_t *roster_usr = (roster_t *)sl_usr->data; // If there is a pending unread message, keep track of it if (roster_usr->flags & ROSTER_FLAG_MSG) unread_jid_add(roster_usr->jid); @@ -534,8 +534,8 @@ const char *realjid) { GSList *sl_user; - roster *roster_usr; - res *p_res; + roster_t *roster_usr; + res_t *p_res; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT); @@ -547,7 +547,7 @@ // If there is no resource name, we can leave now if (!resname) return; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; // New or updated resource p_res = get_or_add_resource(roster_usr, resname, prio); @@ -584,14 +584,14 @@ void roster_setflags(const char *jid, guint flags, guint value) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT); if (sl_user == NULL) return; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; if (value) roster_usr->flags |= flags; else @@ -635,14 +635,14 @@ void roster_msg_setflag(const char *jid, guint special, guint value) { GSList *sl_user; - roster *roster_usr, *roster_grp; + roster_t *roster_usr, *roster_grp; int new_roster_item = FALSE; guint unread_list_modified = FALSE; if (special) { //sl_user = roster_find(jid, namesearch, ROSTER_TYPE_SPECIAL); //if (!sl_user) return; - //roster_usr = (roster*)sl_user->data; + //roster_usr = (roster_t *)sl_user->data; roster_usr = &roster_special; if (value) { if (!(roster_usr->flags & ROSTER_FLAG_MSG)) @@ -674,8 +674,8 @@ new_roster_item = TRUE; } - roster_usr = (roster*)sl_user->data; - roster_grp = (roster*)roster_usr->list->data; + roster_usr = (roster_t *)sl_user->data; + roster_grp = (roster_t *)roster_usr->list->data; if (value) { if (!(roster_usr->flags & ROSTER_FLAG_MSG)) unread_list_modified = TRUE; @@ -705,7 +705,7 @@ // anymore. sl_user = roster_grp->list; while (sl_user) { - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; if (roster_usr->flags & ROSTER_FLAG_MSG) { msg = TRUE; break; @@ -736,14 +736,14 @@ void roster_msg_update_unread(const char *jid, gboolean increment) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT); if (!sl_user) return; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; if (increment) roster_usr->unread++; @@ -758,7 +758,7 @@ enum setuiprio_ops action) { guint oldval, newval; - roster *roster_usr; + roster_t *roster_usr; if (special) { roster_usr = &roster_special; @@ -768,7 +768,7 @@ if (!sl_user) return; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; } oldval = roster_usr->ui_prio; @@ -787,7 +787,7 @@ guint roster_getuiprio(const char *jid, guint special) { - roster *roster_usr; + roster_t *roster_usr; GSList *sl_user; if (special) { @@ -799,61 +799,61 @@ ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT); if (!sl_user) return 0; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; return roster_usr->ui_prio; } const char *roster_getname(const char *jid) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT); if (sl_user == NULL) return NULL; // Not in the roster... - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; return roster_usr->name; } const char *roster_getnickname(const char *jid) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT); if (sl_user == NULL) return NULL; // Not in the roster... - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; return roster_usr->nickname; } void roster_settype(const char *jid, guint type) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; if ((sl_user = roster_find(jid, jidsearch, 0)) == NULL) return; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; roster_usr->type = type; } enum imstatus roster_getstatus(const char *jid, const char *resname) { GSList *sl_user; - roster *roster_usr; - res *p_res; + roster_t *roster_usr; + res_t *p_res; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT); if (sl_user == NULL) return offline; // Not in the roster, anyway... - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; p_res = get_resource(roster_usr, resname); if (p_res) return p_res->status; @@ -863,14 +863,14 @@ const char *roster_getstatusmsg(const char *jid, const char *resname) { GSList *sl_user; - roster *roster_usr; - res *p_res; + roster_t *roster_usr; + res_t *p_res; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT); if (sl_user == NULL) return NULL; // Not in the roster, anyway... - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; p_res = get_resource(roster_usr, resname); if (p_res) return p_res->status_msg; @@ -880,14 +880,14 @@ char roster_getprio(const char *jid, const char *resname) { GSList *sl_user; - roster *roster_usr; - res *p_res; + roster_t *roster_usr; + res_t *p_res; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT); if (sl_user == NULL) return offline; // Not in the roster, anyway... - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; p_res = get_resource(roster_usr, resname); if (p_res) return p_res->prio; @@ -897,24 +897,24 @@ guint roster_gettype(const char *jid) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; if ((sl_user = roster_find(jid, jidsearch, 0)) == NULL) return 0; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; return roster_usr->type; } guint roster_getsubscription(const char *jid) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; if ((sl_user = roster_find(jid, jidsearch, 0)) == NULL) return 0; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; return roster_usr->subscription; } @@ -924,13 +924,13 @@ void roster_unsubscribed(const char *jid) { GSList *sl_user; - roster *roster_usr; + roster_t *roster_usr; sl_user = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT); if (sl_user == NULL) return; - roster_usr = (roster*)sl_user->data; + roster_usr = (roster_t *)sl_user->data; free_all_resources(&roster_usr->resource); } @@ -984,10 +984,10 @@ void buddylist_build(void) { GSList *sl_roster_elt = groups; - roster *roster_elt; - roster *roster_current_buddy = NULL; - roster *roster_alternate_buddy = NULL; - roster *roster_last_activity_buddy = NULL; + roster_t *roster_elt; + roster_t *roster_current_buddy = NULL; + roster_t *roster_alternate_buddy = NULL; + roster_t *roster_last_activity_buddy = NULL; int shrunk_group; if (_rebuild_buddylist == FALSE) @@ -1016,15 +1016,15 @@ // Create the new list while (sl_roster_elt) { GSList *sl_roster_usrelt; - roster *roster_usrelt; + roster_t *roster_usrelt; guint pending_group = TRUE; - roster_elt = (roster*) sl_roster_elt->data; + roster_elt = (roster_t *) sl_roster_elt->data; shrunk_group = roster_elt->flags & ROSTER_FLAG_HIDE; sl_roster_usrelt = roster_elt->list; while (sl_roster_usrelt) { - roster_usrelt = (roster*) sl_roster_usrelt->data; + roster_usrelt = (roster_t *) sl_roster_usrelt->data; // Buddy will be added if either: // - buddy's status matches the display_filter @@ -1072,7 +1072,7 @@ // "hide" values: 1=hide 0=show_all -1=invert void buddy_hide_group(gpointer rosterdata, int hide) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (hide > 0) // TRUE (hide) roster_usr->flags |= ROSTER_FLAG_HIDE; else if (hide < 0) // NEG (invert) @@ -1083,7 +1083,7 @@ const char *buddy_getjid(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (!rosterdata) return NULL; return roster_usr->jid; @@ -1096,10 +1096,10 @@ // void buddy_setgroup(gpointer rosterdata, char *newgroupname) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; GSList **sl_group; GSList *sl_newgroup; - roster *my_newgroup; + roster_t *my_newgroup; // A group has no group :) if (roster_usr->type & ROSTER_TYPE_GROUP) return; @@ -1108,15 +1108,15 @@ if (!newgroupname) newgroupname = ""; sl_newgroup = roster_add_group(newgroupname); if (!sl_newgroup) return; - my_newgroup = (roster*)sl_newgroup->data; + my_newgroup = (roster_t *)sl_newgroup->data; // Remove the buddy from current group - sl_group = &((roster*)((GSList*)roster_usr->list)->data)->list; + sl_group = &((roster_t *)((GSList*)roster_usr->list)->data)->list; *sl_group = g_slist_remove(*sl_group, rosterdata); // Remove old group if it is empty if (!*sl_group) { - roster *roster_grp = (roster*)((GSList*)roster_usr->list)->data; + roster_t *roster_grp = (roster_t *)((GSList*)roster_usr->list)->data; g_free((gchar*)roster_grp->jid); g_free((gchar*)roster_grp->name); g_free(roster_grp); @@ -1133,7 +1133,7 @@ void buddy_setname(gpointer rosterdata, char *newname) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; GSList **sl_group; // TODO For groups, we need to check for unicity @@ -1149,7 +1149,7 @@ roster_usr->name = g_strdup(newname); // We need to resort the group list - sl_group = &((roster*)((GSList*)roster_usr->list)->data)->list; + sl_group = &((roster_t *)((GSList*)roster_usr->list)->data)->list; *sl_group = g_slist_sort(*sl_group, (GCompareFunc)&roster_compare_name); buddylist_defer_build(); @@ -1157,7 +1157,7 @@ const char *buddy_getname(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->name; } @@ -1165,7 +1165,7 @@ // Only for chatrooms void buddy_setnickname(gpointer rosterdata, const char *newname) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (!(roster_usr->type & ROSTER_TYPE_ROOM)) return; // XXX Error message? @@ -1179,7 +1179,7 @@ const char *buddy_getnickname(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->nickname; } @@ -1187,7 +1187,7 @@ // Only for chatrooms void buddy_setinsideroom(gpointer rosterdata, guint inside) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (!(roster_usr->type & ROSTER_TYPE_ROOM)) return; @@ -1196,7 +1196,7 @@ guint buddy_getinsideroom(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->inside_room; } @@ -1204,7 +1204,7 @@ // Only for chatrooms void buddy_settopic(gpointer rosterdata, const char *newtopic) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (!(roster_usr->type & ROSTER_TYPE_ROOM)) return; @@ -1218,43 +1218,43 @@ const char *buddy_gettopic(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->topic; } void buddy_setprintstatus(gpointer rosterdata, enum room_printstatus pstatus) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; roster_usr->print_status = pstatus; } enum room_printstatus buddy_getprintstatus(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->print_status; } void buddy_setautowhois(gpointer rosterdata, enum room_autowhois awhois) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; roster_usr->auto_whois = awhois; } enum room_autowhois buddy_getautowhois(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->auto_whois; } void buddy_setflagjoins(gpointer rosterdata, enum room_flagjoins fjoins) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; roster_usr->flag_joins = fjoins; } enum room_flagjoins buddy_getflagjoins(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->flag_joins; } @@ -1262,7 +1262,7 @@ // Returns a pointer on buddy's group name. const char *buddy_getgroupname(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (roster_usr->type & ROSTER_TYPE_GROUP) return roster_usr->name; @@ -1271,14 +1271,14 @@ return NULL; // This is a user - return ((roster*)((GSList*)roster_usr->list)->data)->name; + return ((roster_t *)((GSList*)roster_usr->list)->data)->name; } // buddy_getgroup() // Returns a pointer on buddy's group. gpointer buddy_getgroup(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (roster_usr->type & ROSTER_TYPE_GROUP) return rosterdata; @@ -1292,26 +1292,26 @@ void buddy_settype(gpointer rosterdata, guint type) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; roster_usr->type = type; } guint buddy_gettype(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->type; } guint buddy_getsubscription(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->subscription; } enum imstatus buddy_getstatus(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->status; return offline; @@ -1319,8 +1319,8 @@ const char *buddy_getstatusmsg(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->status_msg; return roster_usr->offline_status_message; @@ -1328,8 +1328,8 @@ time_t buddy_getstatustime(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->status_timestamp; return 0; @@ -1337,8 +1337,8 @@ gchar buddy_getresourceprio(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->prio; return 0; @@ -1346,8 +1346,8 @@ guint buddy_resource_getevents(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->events; return ROSTER_EVENT_NONE; @@ -1356,16 +1356,16 @@ void buddy_resource_setevents(gpointer rosterdata, const char *resname, guint events) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) p_res->events = events; } char *buddy_resource_getcaps(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->caps; return NULL; @@ -1374,8 +1374,8 @@ void buddy_resource_setcaps(gpointer rosterdata, const char *resname, const char *caps) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) { g_free(p_res->caps); p_res->caps = g_strdup(caps); @@ -1385,8 +1385,8 @@ struct xep0085 *buddy_resource_xep85(gpointer rosterdata, const char *resname) { #ifdef XEP0085 - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return &p_res->xep85; #endif @@ -1396,8 +1396,8 @@ struct pgp_data *buddy_resource_pgp(gpointer rosterdata, const char *resname) { #ifdef HAVE_GPGME - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return &p_res->pgpdata; #endif @@ -1406,8 +1406,8 @@ enum imrole buddy_getrole(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->role; return role_none; @@ -1415,8 +1415,8 @@ enum imaffiliation buddy_getaffil(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->affil; return affil_none; @@ -1424,8 +1424,8 @@ const char *buddy_getrjid(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) return p_res->realjid; return NULL; @@ -1437,7 +1437,7 @@ // If roster_data is null, the current buddy is selected GSList *buddy_getresources(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; GSList *reslist = NULL, *lp; if (!roster_usr) { @@ -1445,7 +1445,7 @@ roster_usr = BUDDATA(current_buddy); } for (lp = roster_usr->resource; lp; lp = g_slist_next(lp)) - reslist = g_slist_append(reslist, g_strdup(((res*)lp->data)->name)); + reslist = g_slist_append(reslist, g_strdup(((res_t *)lp->data)->name)); return reslist; } @@ -1474,8 +1474,8 @@ // Returns name of active (selected for chat) resource const char *buddy_getactiveresource(gpointer rosterdata) { - roster *roster_usr = rosterdata; - res *resource; + roster_t *roster_usr = rosterdata; + res_t *resource; if (!roster_usr) { if (!current_buddy) return NULL; @@ -1489,8 +1489,8 @@ void buddy_setactiveresource(gpointer rosterdata, const char *resname) { - roster *roster_usr = rosterdata; - res *p_res = NULL; + roster_t *roster_usr = rosterdata; + res_t *p_res = NULL; if (resname) p_res = get_resource(roster_usr, resname); roster_usr->active_resource = p_res; @@ -1502,7 +1502,7 @@ // (which means, for a room, that it isn't empty) int buddy_isresource(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (!roster_usr) return FALSE; if (roster_usr->resource) @@ -1516,8 +1516,8 @@ void buddy_resource_setname(gpointer rosterdata, const char *resname, const char *newname) { - roster *roster_usr = rosterdata; - res *p_res = get_resource(roster_usr, resname); + roster_t *roster_usr = rosterdata; + res_t *p_res = get_resource(roster_usr, resname); if (p_res) { if (p_res->name) { g_free((gchar*)p_res->name); @@ -1532,10 +1532,10 @@ // Remove all resources from the specified buddy void buddy_del_all_resources(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; while (roster_usr->resource) { - res *r = roster_usr->resource->data; + res_t *r = roster_usr->resource->data; del_resource(roster_usr, r->name); } } @@ -1544,7 +1544,7 @@ // Set one or several flags to value (TRUE/FALSE) void buddy_setflags(gpointer rosterdata, guint flags, guint value) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; if (value) roster_usr->flags |= flags; else @@ -1553,19 +1553,19 @@ guint buddy_getflags(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->flags; } guint buddy_getuiprio(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->ui_prio; } guint buddy_getunread(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->unread; } @@ -1573,13 +1573,13 @@ // Set the on_server flag void buddy_setonserverflag(gpointer rosterdata, guint onserver) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; roster_usr->on_server = onserver; } guint buddy_getonserverflag(gpointer rosterdata) { - roster *roster_usr = rosterdata; + roster_t *roster_usr = rosterdata; return roster_usr->on_server; } @@ -1590,13 +1590,13 @@ GList *buddy_search_jid(const char *jid) { GList *buddy; - roster *roster_usr; + roster_t *roster_usr; buddylist_build(); if (!buddylist) return NULL; for (buddy = buddylist; buddy; buddy = g_list_next(buddy)) { - roster_usr = (roster*)buddy->data; + roster_usr = (roster_t *)buddy->data; if (roster_usr->jid && !strcasecmp(roster_usr->jid, jid)) return buddy; } @@ -1610,7 +1610,7 @@ GList *buddy_search(char *string) { GList *buddy = current_buddy; - roster *roster_usr; + roster_t *roster_usr; buddylist_build(); if (!buddylist || !current_buddy) return NULL; for (;;) { @@ -1621,7 +1621,7 @@ if (!buddy) buddy = buddylist; - roster_usr = (roster*)buddy->data; + roster_usr = (roster_t *)buddy->data; jid_locale = from_utf8(roster_usr->jid); if (jid_locale) { @@ -1651,17 +1651,17 @@ void *param) { GSList *sl_roster_elt = groups; - roster *roster_elt; + roster_t *roster_elt; GSList *sl_roster_usrelt; - roster *roster_usrelt; + roster_t *roster_usrelt; while (sl_roster_elt) { // group list loop - roster_elt = (roster*) sl_roster_elt->data; + roster_elt = (roster_t *) sl_roster_elt->data; if (roster_elt->type & ROSTER_TYPE_SPECIAL) continue; // Skip special items sl_roster_usrelt = roster_elt->list; while (sl_roster_usrelt) { // user list loop - roster_usrelt = (roster*) sl_roster_usrelt->data; + roster_usrelt = (roster_t *) sl_roster_usrelt->data; if (roster_usrelt->type & roster_type) pfunc(roster_usrelt, param); @@ -1678,9 +1678,9 @@ void (*pfunc)(gpointer rosterdata, void *param), void *param) { - roster *roster_elt; + roster_t *roster_elt; GSList *sl_roster_usrelt; - roster *roster_usrelt; + roster_t *roster_usrelt; roster_elt = groupdata; @@ -1690,7 +1690,7 @@ sl_roster_usrelt = roster_elt->list; while (sl_roster_usrelt) { // user list loop GSList *next_sl_usrelt; - roster_usrelt = (roster*) sl_roster_usrelt->data; + roster_usrelt = (roster_t *) sl_roster_usrelt->data; next_sl_usrelt = g_slist_next(sl_roster_usrelt); pfunc(roster_usrelt, param); @@ -1706,12 +1706,12 @@ { GSList *list = NULL; GSList *sl_roster_elt = groups; - roster *roster_elt; + roster_t *roster_elt; GSList *sl_roster_usrelt; - roster *roster_usrelt; + roster_t *roster_usrelt; while (sl_roster_elt) { // group list loop - roster_elt = (roster*) sl_roster_elt->data; + roster_elt = (roster_t *) sl_roster_elt->data; if (roster_elt->type & ROSTER_TYPE_SPECIAL) continue; // Skip special items @@ -1722,7 +1722,7 @@ } else { // ROSTER_TYPE_USER (jid) (or agent, or chatroom...) sl_roster_usrelt = roster_elt->list; while (sl_roster_usrelt) { // user list loop - roster_usrelt = (roster*) sl_roster_usrelt->data; + roster_usrelt = (roster_t *) sl_roster_usrelt->data; if (roster_usrelt->jid) list = g_slist_append(list, from_utf8(roster_usrelt->jid)); diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/screen.c --- a/mcabber/mcabber/screen.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/screen.c Sun May 12 11:32:30 2019 +0200 @@ -109,13 +109,13 @@ char lock; char refcount; // refcount > 0 if there are other users of this struct // e.g. with symlinked history -} buffdata; +} buffdata_t; typedef struct { WINDOW *win; PANEL *panel; - buffdata *bd; -} winbuf; + buffdata_t *bd; +} winbuf_t; struct dimensions { int l; @@ -129,8 +129,8 @@ static PANEL *logPanel; static int maxY, maxX; static int prev_chatwidth; -static winbuf *statusWindow; -static winbuf *currentWindow; +static winbuf_t *statusWindow; +static winbuf_t *currentWindow; static GList *statushbuf; static int roster_hidden; @@ -174,7 +174,7 @@ char *seqstr; guint mkeycode; gint value; -} keyseq; +} keyseq_t; GSList *keyseqlist; static void add_keyseq(char *seqstr, guint mkeycode, gint value); @@ -203,7 +203,7 @@ AspellConfig *config; AspellSpeller *checker; #endif -} spell_checker; +} spell_checker_t; GSList* spell_checkers = NULL; #endif @@ -211,13 +211,13 @@ typedef struct { int color_pair; int color_attrib; -} ccolor; +} ccolor_t; typedef struct { char *status, *wildcard; - ccolor *color; + ccolor_t *color; GPatternSpec *compiled; -} rostercolor; +} rostercolor_t; static GSList *rostercolrules = NULL; @@ -225,12 +225,12 @@ typedef struct { bool manual; // Manually set? - ccolor *color; -} nickcolor; + ccolor_t *color; +} nickcolor_t; static int nickcolcount = 0; -static ccolor ** nickcols = NULL; -static muccoltype glob_muccol = MC_OFF; +static ccolor_t ** nickcols = NULL; +static muccol_t glob_muccol = MC_OFF; /* Functions */ @@ -266,11 +266,11 @@ return -1; } -static ccolor *get_user_color(const char *color) +static ccolor_t *get_user_color(const char *color) { bool isbright = FALSE; int cl; - ccolor *ccol; + ccolor_t *ccol; if (!strncmp(color, "bright", 6)) { isbright = TRUE; color += 6; @@ -278,7 +278,7 @@ cl = find_color(color); if (cl < 0) return NULL; - ccol = g_new0(ccolor, 1); + ccol = g_new0(ccolor_t, 1); ccol->color_attrib = isbright ? A_BOLD : A_NORMAL; ccol->color_pair = cl + COLOR_max; // User colors come after the internal ones return ccol; @@ -297,7 +297,7 @@ // The MUC room does not need to be in the roster at that time // muc - the JID of room // type - the new type -void scr_muc_color(const char *muc, muccoltype type) +void scr_muc_color(const char *muc, muccol_t type) { gchar *muclow = g_utf8_strdown(muc, -1); if (type == MC_REMOVE) { // Remove it @@ -310,7 +310,7 @@ g_free(muclow); } else { // Add or overwrite if (strcmp(muc, "*")) { - muccoltype *value = g_new(muccoltype, 1); + muccol_t *value = g_new(muccol_t, 1); *value = type; ensure_string_htable(&muccolors, g_free); g_hash_table_replace(muccolors, muclow, value); @@ -336,7 +336,7 @@ mnick = g_strdup_printf("*%s ", nick); if (!strcmp(color, "-")) { // Remove the color if (nickcolors) { - nickcolor *nc = g_hash_table_lookup(nickcolors, snick); + nickcolor_t *nc = g_hash_table_lookup(nickcolors, snick); if (nc) { // Have this nick already nc->manual = FALSE; nc = g_hash_table_lookup(nickcolors, mnick); @@ -348,13 +348,13 @@ g_free(mnick); need_update = TRUE; } else { - ccolor *cl = get_user_color(color); + ccolor_t *cl = get_user_color(color); if (!cl) { scr_LogPrint(LPRINT_NORMAL, "No such color name"); g_free(snick); g_free(mnick); } else { - nickcolor *nc = g_new(nickcolor, 1); + nickcolor_t *nc = g_new(nickcolor_t, 1); ensure_string_htable(&nickcolors, NULL); nc->manual = TRUE; nc->color = cl; @@ -371,7 +371,7 @@ scr_update_buddy_window(); } -static void free_rostercolrule(rostercolor *col) +static void free_rostercolrule(rostercolor_t *col) { g_free(col->status); g_free(col->wildcard); @@ -405,7 +405,7 @@ GSList *head; GSList *found = NULL; for (head = rostercolrules; head; head = g_slist_next(head)) { - rostercolor *rc = head->data; + rostercolor_t *rc = head->data; if ((!strcmp(status, rc->status)) && (!strcmp(wildcard, rc->wildcard))) { found = head; break; @@ -422,17 +422,17 @@ return FALSE; } } else { - ccolor *cl = get_user_color(color); + ccolor_t *cl = get_user_color(color); if (!cl) { scr_LogPrint(LPRINT_NORMAL, "No such color name"); return FALSE; } if (found) { - rostercolor *rc = found->data; + rostercolor_t *rc = found->data; g_free(rc->color); rc->color = cl; } else { - rostercolor *rc = g_new(rostercolor, 1); + rostercolor_t *rc = g_new(rostercolor_t, 1); rc->status = g_strdup(status); rc->wildcard = g_strdup(wildcard); rc->compiled = g_pattern_spec_new(wildcard); @@ -569,7 +569,7 @@ ncolors++; } else { char *end = ncolors; - ccolor *cl; + ccolor_t *cl; while (*end && (*end != ' ') && (*end != '\t')) end++; *end = '\0'; @@ -587,8 +587,8 @@ } if (!nickcols) { // Fallback to have something nickcolcount = 1; - nickcols = g_new(ccolor*, 1); - *nickcols = g_new(ccolor, 1); + nickcols = g_new(ccolor_t*, 1); + *nickcols = g_new(ccolor_t, 1); (*nickcols)->color_pair = COLOR_GENERAL; (*nickcols)->color_attrib = A_NORMAL; } @@ -1036,10 +1036,10 @@ scr_log_print(LPRINT_NORMAL, "[%s] %s", log_domain, message); } -static winbuf *scr_search_window(const char *winId, int special) +static winbuf_t *scr_search_window(const char *winId, int special) { char *id; - winbuf *wbp; + winbuf_t *wbp; if (special) return statusWindow; // Only one special window atm. @@ -1061,12 +1061,12 @@ // scr_new_buddy(title, dontshow) // Note: title (aka winId/jid) can be NULL for special buffers -static winbuf *scr_new_buddy(const char *title, int dont_show) +static winbuf_t *scr_new_buddy(const char *title, int dont_show) { - winbuf *tmp; + winbuf_t *tmp; char *id; - tmp = g_new0(winbuf, 1); + tmp = g_new0(winbuf_t, 1); tmp->win = activechatWnd; tmp->panel = activechatPanel; @@ -1083,7 +1083,7 @@ // If title is NULL, this is a special buffer if (!title) { - tmp->bd = g_new0(buffdata, 1); + tmp->bd = g_new0(buffdata_t, 1); return tmp; } @@ -1091,14 +1091,14 @@ if (id) { // This is a symlinked history log file. // Let's check if the target JID buffer has already been created. - winbuf *wb = scr_search_window(id, FALSE); + winbuf_t *wb = scr_search_window(id, FALSE); if (!wb) wb = scr_new_buddy(id, TRUE); tmp->bd = wb->bd; tmp->bd->refcount++; g_free(id); } else { // Load buddy history from file (if enabled) - tmp->bd = g_new0(buffdata, 1); + tmp->bd = g_new0(buffdata_t, 1); hlog_read_history(title, &tmp->bd->hbuf, scr_gettextwidth()); // Set a readmark to separate new content @@ -1177,7 +1177,7 @@ // scr_update_window() // (Re-)Display the given chat window. -static void scr_update_window(winbuf *win_entry) +static void scr_update_window(winbuf_t *win_entry) { int n, mark_offset = 0; guint prefixwidth; @@ -1295,8 +1295,8 @@ if (line->mucnicklen) { char *mucjid; char tmp; - nickcolor *actual = NULL; - muccoltype type, *typetmp; + nickcolor_t *actual = NULL; + muccol_t type, *typetmp; // Store the char after the nick tmp = line->text[line->mucnicklen]; @@ -1314,12 +1314,12 @@ if ((type == MC_ALL) && (!nickcolors || !g_hash_table_lookup(nickcolors, line->text))) { char *snick, *mnick; - nickcolor *nc; + nickcolor_t *nc; const char *p = line->text; unsigned int nicksum = 0; snick = g_strdup(line->text); mnick = g_strdup(line->text); - nc = g_new(nickcolor, 1); + nc = g_new(nickcolor_t, 1); ensure_string_htable(&nickcolors, NULL); while (*p) nicksum += *p++; @@ -1395,7 +1395,7 @@ g_free(lines); } -static winbuf *scr_create_window(const char *winId, int special, int dont_show) +static winbuf_t *scr_create_window(const char *winId, int special, int dont_show) { if (special) { if (!statusWindow) { @@ -1413,7 +1413,7 @@ // "special" must be true if this is a special buffer window. static void scr_show_window(const char *winId, int special) { - winbuf *win_entry; + winbuf_t *win_entry; win_entry = scr_search_window(winId, special); @@ -1492,7 +1492,7 @@ int force_show, unsigned mucnicklen, gpointer xep184) { - winbuf *win_entry; + winbuf_t *win_entry; char *text_locale; int dont_show = FALSE; int special; @@ -1849,7 +1849,7 @@ static void resize_win_buffer(gpointer key, gpointer value, gpointer data) { - winbuf *wbp = value; + winbuf_t *wbp = value; struct dimensions *dim = data; int chat_x_pos, chat_y_pos; int new_chatwidth; @@ -1989,7 +1989,7 @@ } if (chatmode && !isgrp) { - winbuf *win_entry; + winbuf_t *win_entry; win_entry = scr_search_window(buddy_getjid(BUDDATA(current_buddy)), isspe); if (win_entry && win_entry->bd->lock) mvwprintw(chatstatusWnd, 0, 0, "*"); @@ -2258,7 +2258,7 @@ GSList *head; const char *bjid = buddy_getjid(BUDDATA(buddy)); for (head = rostercolrules; head; head = g_slist_next(head)) { - rostercolor *rc = head->data; + rostercolor_t *rc = head->data; if (g_pattern_match_string(rc->compiled, bjid) && (!strcmp("*", rc->status) || strchr(rc->status, status))) { color = compose_color(rc->color); @@ -2414,7 +2414,7 @@ void scr_remove_receipt_flag(const char *bjid, gconstpointer xep184) { - winbuf *win_entry = scr_search_window(bjid, FALSE); + winbuf_t *win_entry = scr_search_window(bjid, FALSE); if (win_entry && xep184) { hbuf_remove_receipt(win_entry->bd->hbuf, xep184); if (chatmode && (buddy_search_jid(bjid) == current_buddy)) @@ -2843,7 +2843,7 @@ // - up if updown == -1, down if updown == 1 void scr_buffer_scroll_up_down(int updown, unsigned int nblines) { - winbuf *win_entry; + winbuf_t *win_entry; int n, nbl; GList *hbuf_top; guint isspe; @@ -2900,7 +2900,7 @@ // Clear the current buddy window (used for the /clear command) void scr_buffer_clear(void) { - winbuf *win_entry; + winbuf_t *win_entry; guint isspe; // Get win_entry @@ -2921,14 +2921,14 @@ // buffer_purge() // key: winId/jid -// value: winbuf structure +// value: winbuf_t structure // data: int, set to 1 if the buffer should be closed. // NOTE: does not work for special buffers. // Returns TRUE IFF the win_entry can be closed and freed. static gboolean buffer_purge(gpointer key, gpointer value, gpointer data) { int *p_closebuf = data; - winbuf *win_entry = value; + winbuf_t *win_entry = value; gboolean retval = FALSE; // Delete the current hbuf @@ -2961,7 +2961,7 @@ // If closebuf is 1, close the buffer. void scr_buffer_purge(int closebuf, const char *jid) { - winbuf *win_entry; + winbuf_t *win_entry; guint isspe; const char *cjid; char *ljid = NULL; @@ -3048,7 +3048,7 @@ // lock = -1: toggle lock status void scr_buffer_scroll_lock(int lock) { - winbuf *win_entry; + winbuf_t *win_entry; guint isspe; // Get win_entry @@ -3091,7 +3091,7 @@ // If action = -1, remove the readmark flag iff it is on the last line void scr_buffer_readmark(gchar action) { - winbuf *win_entry; + winbuf_t *win_entry; guint isspe; int autolock; @@ -3117,7 +3117,7 @@ // (top if topbottom == -1, bottom topbottom == 1) void scr_buffer_top_bottom(int topbottom) { - winbuf *win_entry; + winbuf_t *win_entry; guint isspe; // Get win_entry @@ -3144,7 +3144,7 @@ // (backward search if direction == -1, forward if topbottom == 1) void scr_buffer_search(int direction, const char *text) { - winbuf *win_entry; + winbuf_t *win_entry; GList *current_line, *search_res; guint isspe; @@ -3178,7 +3178,7 @@ // Jump to the specified position in the buffer, in % void scr_buffer_percent(int pc) { - winbuf *win_entry; + winbuf_t *win_entry; GList *search_res; guint isspe; @@ -3210,7 +3210,7 @@ // t is a date in seconds since `00:00:00 1970-01-01 UTC' void scr_buffer_date(time_t t) { - winbuf *win_entry; + winbuf_t *win_entry; GList *search_res; guint isspe; @@ -3239,7 +3239,7 @@ // Jump to the buffer readmark, if there's one void scr_buffer_jump_readmark(void) { - winbuf *win_entry; + winbuf_t *win_entry; GList *search_res; guint isspe; @@ -3290,12 +3290,12 @@ // buffer_list() // key: winId/jid -// value: winbuf structure +// value: winbuf_t structure // data: none. static void buffer_list(gpointer key, gpointer value, gpointer data) { GList *head; - winbuf *win_entry = value; + winbuf_t *win_entry = value; head = g_list_first(win_entry->bd->hbuf); @@ -3355,7 +3355,7 @@ else current_id = buddy_getjid(BUDDATA(current_buddy)); if (current_id) { - winbuf *win_entry = scr_search_window(current_id, special); + winbuf_t *win_entry = scr_search_window(current_id, special); if (!win_entry) return; iscurrentlocked = win_entry->bd->lock; } @@ -3375,7 +3375,7 @@ guint value, enum setuiprio_ops action) { const char *current_id; - winbuf *wb; + winbuf_t *wb; bool iscurrentlocked = FALSE; if (!bjid) @@ -3391,7 +3391,7 @@ else current_id = buddy_getjid(BUDDATA(current_buddy)); if (current_id) { - winbuf *win_entry = scr_search_window(current_id, special); + winbuf_t *win_entry = scr_search_window(current_id, special); if (!win_entry) return; iscurrentlocked = win_entry->bd->lock; } @@ -4252,7 +4252,7 @@ static void add_keyseq(char *seqstr, guint mkeycode, gint value) { - keyseq *ks; + keyseq_t *ks; // Let's make sure the length is correct if (strlen(seqstr) > MAX_KEYSEQ_LENGTH) { @@ -4260,7 +4260,7 @@ return; } - ks = g_new0(keyseq, 1); + ks = g_new0(keyseq_t, 1); ks->seqstr = g_strdup(seqstr); ks->mkeycode = mkeycode; ks->value = value; @@ -4274,10 +4274,10 @@ // 0 if "seq" could match 1 or more known sequences // >0 if "seq" matches a key sequence; the mkey code is returned // and *ret is set to the matching keyseq structure. -static inline gint match_keyseq(int *iseq, keyseq **ret) +static inline gint match_keyseq(int *iseq, keyseq_t **ret) { GSList *ksl; - keyseq *ksp; + keyseq_t *ksp; char *p, c; int *i; int needmore = FALSE; @@ -4332,13 +4332,13 @@ return c; } -void scr_getch(keycode *kcode) +void scr_getch(keycode_t *kcode) { - keyseq *mks = NULL; + keyseq_t *mks = NULL; int ks[MAX_KEYSEQ_LENGTH+1]; int i; - memset(kcode, 0, sizeof(keycode)); + memset(kcode, 0, sizeof(keycode_t)); memset(ks, 0, sizeof(ks)); kcode->value = wgetch(inputWnd); @@ -4424,7 +4424,7 @@ doupdate(); } -static void bindcommand(keycode kcode) +static void bindcommand(keycode_t kcode) { gchar asciikey[16], asciicode[16]; const gchar *boundcmd; @@ -4509,7 +4509,7 @@ // scr_process_key(key) // Handle the pressed key, in the command line (bottom). -void scr_process_key(keycode kcode) +void scr_process_key(keycode_t kcode) { int key = kcode.value; int display_char = FALSE; @@ -4879,7 +4879,7 @@ #if defined(WITH_ENCHANT) || defined(WITH_ASPELL) static void spell_checker_free(gpointer data) { - spell_checker* sc = data; + spell_checker_t *sc = data; #ifdef WITH_ENCHANT enchant_broker_free_dict(sc->broker, sc->checker); enchant_broker_free(sc->broker); @@ -4891,9 +4891,9 @@ g_free(sc); } -static spell_checker* new_spell_checker(const char* spell_lang) +static spell_checker_t* new_spell_checker(const char* spell_lang) { - spell_checker* sc = g_new(spell_checker, 1); + spell_checker_t *sc = g_new(spell_checker_t, 1); #ifdef WITH_ASPELL const char *spell_encoding = settings_opt_get("spell_encoding"); AspellCanHaveError *possible_err; @@ -4928,9 +4928,9 @@ { int spell_enable = settings_opt_get_int("spell_enable"); const char *spell_lang = settings_opt_get("spell_lang"); - gchar** langs; - gchar** lang_iter; - spell_checker* sc; + gchar **langs; + gchar **lang_iter; + spell_checker_t *sc; if (!spell_enable) return; @@ -4970,12 +4970,12 @@ typedef struct { const char* str; int len; -} spell_substring; +} spell_substring_t; static int spellcheckword(gconstpointer sc_ptr, gconstpointer substr_ptr) { - spell_checker* sc = (spell_checker*) sc_ptr; - spell_substring* substr = (spell_substring*) substr_ptr; + spell_checker_t *sc = (spell_checker_t*) sc_ptr; + spell_substring_t *substr = (spell_substring_t*) substr_ptr; #ifdef WITH_ENCHANT // enchant_dict_check will return 0 on good word return enchant_dict_check(sc->checker, substr->str, substr->len); @@ -4993,7 +4993,7 @@ static void spellcheck(char *line, char *checked) { const char *start, *line_start; - spell_substring substr; + spell_substring_t substr; if (inputLine[0] == 0 || inputLine[0] == COMMAND_CHAR) return; diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/screen.h --- a/mcabber/mcabber/screen.h Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/screen.h Sun May 12 11:32:30 2019 +0200 @@ -83,14 +83,14 @@ MKEY_CTRL_SHIFT_END, MKEY_MOUSE } mcode; -} keycode; +} keycode_t; typedef enum { MC_ALL, MC_PRESET, MC_OFF, MC_REMOVE -} muccoltype; +} muccol_t; void scr_write_incoming_message(const char *jidfrom, const char *text, @@ -99,8 +99,8 @@ void scr_write_outgoing_message(const char *jidto, const char *text, guint prefix, gpointer xep184); -void scr_getch(keycode *kcode); -void scr_process_key(keycode kcode); +void scr_getch(keycode_t *kcode); +void scr_process_key(keycode_t kcode); void scr_init_bindings(void); void scr_init_locale_charset(void); @@ -170,7 +170,7 @@ bool scr_roster_color(const char *status, const char *wildcard, const char *color); void scr_roster_clear_color(void); -void scr_muc_color(const char *muc, muccoltype type); +void scr_muc_color(const char *muc, muccol_t type); void scr_muc_nick_color(const char *nick, const char *color); void readline_transpose_chars(void); diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/settings.c --- a/mcabber/mcabber/settings.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/settings.c Sun May 12 11:32:30 2019 +0200 @@ -47,7 +47,7 @@ gchar *pgp_keyid; /* KeyId the contact is supposed to use */ guint pgp_disabled; /* If TRUE, PGP is disabled for outgoing messages */ guint pgp_force; /* If TRUE, PGP is used w/o negotiation */ -} T_pgpopt; +} pgpopt_t; #endif typedef struct { @@ -517,13 +517,13 @@ void settings_pgp_setdisabled(const char *bjid, guint value) { #ifdef HAVE_GPGME - T_pgpopt *pgpdata; + pgpopt_t *pgpdata; pgpdata = g_hash_table_lookup(pgpopt, bjid); if (!pgpdata) { // If value is 0, we do not need to create a structure (that's // the default value). if (value) { - pgpdata = g_new0(T_pgpopt, 1); + pgpdata = g_new0(pgpopt_t, 1); pgpdata->pgp_disabled = value; g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); } @@ -540,7 +540,7 @@ guint settings_pgp_getdisabled(const char *bjid) { #ifdef HAVE_GPGME - T_pgpopt *pgpdata; + pgpopt_t *pgpdata; pgpdata = g_hash_table_lookup(pgpopt, bjid); if (pgpdata) return pgpdata->pgp_disabled; @@ -557,13 +557,13 @@ void settings_pgp_setforce(const char *bjid, guint value) { #ifdef HAVE_GPGME - T_pgpopt *pgpdata; + pgpopt_t *pgpdata; pgpdata = g_hash_table_lookup(pgpopt, bjid); if (!pgpdata) { // If value is 0, we do not need to create a structure (that's // the default value). if (value) { - pgpdata = g_new0(T_pgpopt, 1); + pgpdata = g_new0(pgpopt_t, 1); pgpdata->pgp_force = value; g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); } @@ -580,7 +580,7 @@ guint settings_pgp_getforce(const char *bjid) { #ifdef HAVE_GPGME - T_pgpopt *pgpdata; + pgpopt_t *pgpdata; pgpdata = g_hash_table_lookup(pgpopt, bjid); if (pgpdata) return pgpdata->pgp_force; @@ -597,13 +597,13 @@ void settings_pgp_setkeyid(const char *bjid, const char *keyid) { #ifdef HAVE_GPGME - T_pgpopt *pgpdata; + pgpopt_t *pgpdata; pgpdata = g_hash_table_lookup(pgpopt, bjid); if (!pgpdata) { // If keyid is NULL, we do not need to create a structure (that's // the default value). if (keyid) { - pgpdata = g_new0(T_pgpopt, 1); + pgpdata = g_new0(pgpopt_t, 1); pgpdata->pgp_keyid = g_strdup(keyid); g_hash_table_insert(pgpopt, g_strdup(bjid), pgpdata); } @@ -624,7 +624,7 @@ const char *settings_pgp_getkeyid(const char *bjid) { #ifdef HAVE_GPGME - T_pgpopt *pgpdata; + pgpopt_t *pgpdata; pgpdata = g_hash_table_lookup(pgpopt, bjid); if (pgpdata) return pgpdata->pgp_keyid; diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/xmpp_muc.c --- a/mcabber/mcabber/xmpp_muc.c Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/xmpp_muc.c Sun May 12 11:32:30 2019 +0200 @@ -40,7 +40,7 @@ static GSList *invitations = NULL; -static void decline_invitation(event_muc_invitation *invitation, const char *reason) +static void decline_invitation(event_muc_invitation_t *invitation, const char *reason) { // cut and paste from xmpp_room_invite LmMessage *m; @@ -64,7 +64,7 @@ lm_message_unref(m); } -void destroy_event_muc_invitation(event_muc_invitation *invitation) +void destroy_event_muc_invitation(event_muc_invitation_t *invitation) { invitations = g_slist_remove(invitations, invitation); g_free(invitation->to); @@ -80,7 +80,7 @@ // destroy them? (need invitation registry list for that) static gboolean evscallback_invitation(guint evcontext, const char *arg, gpointer userdata) { - event_muc_invitation *invitation = userdata; + event_muc_invitation_t *invitation = userdata; // Sanity check if (G_UNLIKELY(!invitation)) { @@ -799,7 +799,7 @@ { // remove any equal older invites GSList *iel = invitations; while (iel) { - event_muc_invitation *invitation = iel->data; + event_muc_invitation_t *invitation = iel->data; iel = iel -> next; if (!g_strcmp0(to, invitation->to) && !g_strcmp0(passwd, invitation->passwd)) { @@ -820,9 +820,9 @@ { // create event const char *id; char *desc = g_strdup_printf("<%s> invites you to %s", from, to); - event_muc_invitation *invitation; + event_muc_invitation_t *invitation; - invitation = g_new(event_muc_invitation, 1); + invitation = g_new(event_muc_invitation_t, 1); invitation->to = g_strdup(to); invitation->from = g_strdup(from); invitation->passwd = g_strdup(passwd); diff -r 0dc317b5599d -r ffd0e57e9563 mcabber/mcabber/xmpp_muc.h --- a/mcabber/mcabber/xmpp_muc.h Sun May 12 10:10:12 2019 +0200 +++ b/mcabber/mcabber/xmpp_muc.h Sun May 12 11:32:30 2019 +0200 @@ -8,9 +8,9 @@ char *reason; char *evid; gboolean reply; -} event_muc_invitation; +} event_muc_invitation_t; -void destroy_event_muc_invitation(event_muc_invitation *invitation); +void destroy_event_muc_invitation(event_muc_invitation_t *invitation); void roompresence(gpointer room, void *presencedata); void got_invite(const char* from, const char *to, const char* reason, const char* passwd, gboolean reply);