mcabber/mcabber/hbuf.h
author Myhailo Danylenko <isbear@ukrpost.net>
Sun, 14 Oct 2012 17:39:11 +0200
changeset 2032 f740c4128f76
parent 1961 39021fd6b0e1
child 2090 16b04d64ec88
permissions -rw-r--r--
Fix receipts handling according to recent XEP updates * add lm_get_uid() @xmpp_helper.h * identify receipts by id attribute of 'received' subelement instead of stanza id
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
     1
#ifndef __MCABBER_HBUF_H__
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
     2
#define __MCABBER_HBUF_H__ 1
71
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
     3
184
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
     4
#include <time.h>
71
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
     5
#include <glib.h>
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
     6
106
9a31028e8095 [/trunk] Changeset 120 by mikael
mikael
parents: 75
diff changeset
     7
// With current implementation a message must fit in a hbuf block,
9a31028e8095 [/trunk] Changeset 120 by mikael
mikael
parents: 75
diff changeset
     8
// so we shouldn't choose a too small size.
795
b16acadd7d53 Improve support for long messages
Mikael Berthe <mikael@lilotux.net>
parents: 728
diff changeset
     9
#define HBB_BLOCKSIZE   8192    // > 20 please
71
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    10
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    11
// Flags:
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    12
// - ALLOC: the ptr data has been allocated, it can be freed
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    13
// - PERSISTENT: this is a new history line
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    14
#define HBB_FLAG_ALLOC      1
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    15
#define HBB_FLAG_PERSISTENT 2
184
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    16
1204
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    17
#define HBB_PREFIX_IN         (1U<<0)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    18
#define HBB_PREFIX_OUT        (1U<<1)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    19
#define HBB_PREFIX_STATUS     (1U<<2)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    20
#define HBB_PREFIX_AUTH       (1U<<3)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    21
#define HBB_PREFIX_INFO       (1U<<4)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    22
#define HBB_PREFIX_ERR        (1U<<5)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    23
#define HBB_PREFIX_NOFLAG     (1U<<6)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    24
#define HBB_PREFIX_HLIGHT_OUT (1U<<7)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    25
#define HBB_PREFIX_HLIGHT     (1U<<8)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    26
#define HBB_PREFIX_NONE       (1U<<9)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    27
#define HBB_PREFIX_SPECIAL    (1U<<10)
e802ec0c02d2 Basic support for nick highlighting in MUC rooms (the whole line is colored)
Mikael Berthe <mikael@lilotux.net>
parents: 1141
diff changeset
    28
#define HBB_PREFIX_PGPCRYPT   (1U<<11)
1484
7b36b91a4388 New UI message flag (O) when OTR is used
Mikael Berthe <mikael@lilotux.net>
parents: 1424
diff changeset
    29
#define HBB_PREFIX_OTRCRYPT   (1U<<12)
7b36b91a4388 New UI message flag (O) when OTR is used
Mikael Berthe <mikael@lilotux.net>
parents: 1424
diff changeset
    30
#define HBB_PREFIX_CONT       (1U<<13)
1602
f4a2c6f767d1 Message Receipts support (XEP-0184)
franky
parents: 1485
diff changeset
    31
#define HBB_PREFIX_RECEIPT    (1U<<14)
1948
e8cebf5fd36c Add readmark support
Mikael Berthe <mikael@lilotux.net>
parents: 1811
diff changeset
    32
#define HBB_PREFIX_READMARK   (1U<<15)
71
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    33
184
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    34
typedef struct {
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    35
  time_t timestamp;
850
d0781ca2dd08 Use new status buffer window
Mikael Berthe <mikael@lilotux.net>
parents: 847
diff changeset
    36
  guint flags;
1290
e42f48103609 Drawing the MUC nicks by a different color
Michal 'vorner' Vaner <vorner@ucw.cz>
parents: 1268
diff changeset
    37
  unsigned mucnicklen;
184
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    38
  char *text;
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    39
} hbb_line;
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    40
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    41
void hbuf_add_line(GList **p_hbuf, const char *text, time_t timestamp,
1290
e42f48103609 Drawing the MUC nicks by a different color
Michal 'vorner' Vaner <vorner@ucw.cz>
parents: 1268
diff changeset
    42
        guint prefix_flags, guint width, guint maxhbufblocks,
1602
f4a2c6f767d1 Message Receipts support (XEP-0184)
franky
parents: 1485
diff changeset
    43
        unsigned mucnicklen, gpointer xep184);
71
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    44
void hbuf_free(GList **p_hbuf);
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    45
void hbuf_rebuild(GList **p_hbuf, unsigned int width);
189
4f3975f1b852 [/trunk] Changeset 201 by mikael
mikael
parents: 186
diff changeset
    46
GList *hbuf_previous_persistent(GList *l_line);
71
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    47
184
b5aa2b9c425a [/trunk] Changeset 196 by mikael
mikael
parents: 106
diff changeset
    48
hbb_line **hbuf_get_lines(GList *hbuf, unsigned int n);
370
dd9e2eb52916 Add /buffer search_{backward,forward}
Mikael Berthe <mikael@lilotux.net>
parents: 364
diff changeset
    49
GList *hbuf_search(GList *hbuf, int direction, const char *string);
464
e4840b288be0 Add "/buffer date"
Mikael Berthe <mikael@lilotux.net>
parents: 462
diff changeset
    50
GList *hbuf_jump_date(GList *hbuf, time_t t);
462
d580e87c11ed Add "/buffer %n"
Mikael Berthe <mikael@lilotux.net>
parents: 370
diff changeset
    51
GList *hbuf_jump_percent(GList *hbuf, int pc);
1956
f309f343070c Add command /buffer readmark
Mikael Berthe <mikael@lilotux.net>
parents: 1948
diff changeset
    52
GList *hbuf_jump_readmark(GList *hbuf);
2032
f740c4128f76 Fix receipts handling according to recent XEP updates
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1961
diff changeset
    53
gboolean hbuf_remove_receipt(GList *hbuf, gconstpointer xep184);
1948
e8cebf5fd36c Add readmark support
Mikael Berthe <mikael@lilotux.net>
parents: 1811
diff changeset
    54
void hbuf_set_readmark(GList *hbuf, gboolean action);
1961
39021fd6b0e1 Try to improve readmarks in some cases
Mikael Berthe <mikael@lilotux.net>
parents: 1956
diff changeset
    55
void hbuf_remove_trailing_readmark(GList *hbuf);
71
1e9d4949bcfd [/trunk] Changeset 85 by mikael
mikael
parents:
diff changeset
    56
1485
0121b6f3047c New command: /buffer save
Mikael Berthe <mikael@lilotux.net>
parents: 1484
diff changeset
    57
void hbuf_dump_to_file(GList *hbuf, const char *filename);
0121b6f3047c New command: /buffer save
Mikael Berthe <mikael@lilotux.net>
parents: 1484
diff changeset
    58
1227
79c396678f1b Make buffer list display the number of allocated HBB blocks
Mikael Berthe <mikael@lilotux.net>
parents: 1204
diff changeset
    59
guint hbuf_get_blocks_number(GList *p_hbuf);
79c396678f1b Make buffer list display the number of allocated HBB blocks
Mikael Berthe <mikael@lilotux.net>
parents: 1204
diff changeset
    60
1668
41c26b7d2890 Install mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents: 1602
diff changeset
    61
#endif /* __MCABBER_HBUF_H__ */
576
8b3db0b555a1 Add Vim modelines
Mikael Berthe <mikael@lilotux.net>
parents: 513
diff changeset
    62
1811
e6d355e50d7a Update Vim modelines
Mikael Berthe <mikael@lilotux.net>
parents: 1668
diff changeset
    63
/* vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2:  For Vim users... */