summary refs log tree commit diff stats
path: root/lib/nimbase.h
blob: b4309422709499b299eb27701f208a56d990965c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
/*

            Nimrod's Runtime Library
        (c) Copyright 2013 Andreas Rumpf

    See the file "copying.txt", included in this
    distribution, for details about the copyright.
*/

/* compiler symbols:
__BORLANDC__
_MSC_VER
__WATCOMC__
__LCC__
__GNUC__
__DMC__
__POCC__
__TINYC__
__clang__
*/


#ifndef NIMBASE_H
#define NIMBASE_H

#if defined(__GNUC__)
#  define _GNU_SOURCE 1
#endif

#if defined(__TINYC__)
/*#  define __GNUC__ 3
#  define GCC_MAJOR 4
#  define __GNUC_MINOR__ 4
#  define __GNUC_PATCHLEVEL__ 5 */
#  define __DECLSPEC_SUPPORTED 1
#endif

/* calling convention mess ----------------------------------------------- */
#if defined(__GNUC__) || defined(__LCC__) || defined(__POCC__) \
                      || defined(__TINYC__)
  /* these should support C99's inline */
  /* the test for __POCC__ has to come before the test for _MSC_VER,
     because PellesC defines _MSC_VER too. This is brain-dead. */
#  define N_INLINE(rettype, name) inline rettype name
#elif defined(__BORLANDC__) || defined(_MSC_VER)
/* Borland's compiler is really STRANGE here; note that the __fastcall
   keyword cannot be before the return type, but __inline cannot be after
   the return type, so we do not handle this mess in the code generator
   but rather here. */
#  define N_INLINE(rettype, name) __inline rettype name
#elif defined(__DMC__)
#  define N_INLINE(rettype, name) inline rettype name
#elif defined(__WATCOMC__)
#  define N_INLINE(rettype, name) __inline rettype name
#else /* others are less picky: */
#  define N_INLINE(rettype, name) rettype __inline name
#endif

#if defined(__POCC__)
#  define NIM_CONST /* PCC is really picky with const modifiers */
#  undef _MSC_VER /* Yeah, right PCC defines _MSC_VER even if it is
                     not that compatible. Well done. */
#elif defined(__cplusplus)
#  define NIM_CONST /* C++ is picky with const modifiers */
#else
#  define NIM_CONST  const
#endif

#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
#  define NIM_THREADVAR __declspec(thread) 
#else
#  define NIM_THREADVAR __thread
#endif

/* --------------- how int64 constants should be declared: ----------- */
#if defined(__GNUC__) || defined(__LCC__) || \
    defined(__POCC__) || defined(__DMC__) || defined(_MSC_VER)
#  define IL64(x) x##LL
#else /* works only without LL */
#  define IL64(x) ((NI64)x)
#endif

/* ---------------- casting without correct aliasing rules ----------- */

#if defined(__GNUC__)
#  define NIM_CAST(type, ptr) (((union{type __x__;}*)(ptr))->__x__)
#else
#  define NIM_CAST(type, ptr) ((type)(ptr))
#endif

/* ------------------------------------------------------------------- */

#if defined(WIN32) || defined(_WIN32) /* only Windows has this mess... */
#  define N_CDECL(rettype, name) rettype __cdecl name
#  define N_STDCALL(rettype, name) rettype __stdcall name
#  define N_SYSCALL(rettype, name) rettype __syscall name
#  define N_FASTCALL(rettype, name) rettype __fastcall name
#  define N_SAFECALL(rettype, name) rettype __safecall name
/* function pointers with calling convention: */
#  define N_CDECL_PTR(rettype, name) rettype (__cdecl *name)
#  define N_STDCALL_PTR(rettype, name) rettype (__stdcall *name)
#  define N_SYSCALL_PTR(rettype, name) rettype (__syscall *name)
#  define N_FASTCALL_PTR(rettype, name) rettype (__fastcall *name)
#  define N_SAFECALL_PTR(rettype, name) rettype (__safecall *name)

#  define N_LIB_EXPORT  extern __declspec(dllexport)
#  define N_LIB_IMPORT  extern __declspec(dllimport)
#else
#  define N_CDECL(rettype, name) rettype name
#  define N_STDCALL(rettype, name) rettype name
#  define N_SYSCALL(rettype, name) rettype name
#  define N_FASTCALL(rettype, name) rettype name
#  define N_SAFECALL(rettype, name) rettype name
/* function pointers with calling convention: */
#  define N_CDECL_PTR(rettype, name) rettype (*name)
#  define N_STDCALL_PTR(rettype, name) rettype (*name)
#  define N_SYSCALL_PTR(rettype, name) rettype (*name)
#  define N_FASTCALL_PTR(rettype, name) rettype (*name)
#  define N_SAFECALL_PTR(rettype, name) rettype (*name)

#  define N_LIB_EXPORT  extern
#  define N_LIB_IMPORT  extern
#endif

#define N_NOCONV(rettype, name) rettype name
/* specify no calling convention */
#define N_NOCONV_PTR(rettype, name) rettype (*name)

#if defined(__GNUC__) || defined(__ICC__)
#  define N_NOINLINE(rettype, name) rettype __attribute__((noinline)) name
#elif defined(_MSC_VER)
#  define N_NOINLINE(rettype, name) __declspec(noinline) rettype name
#else
#  define N_NOINLINE(rettype, name) rettype name
#endif

#define N_NOINLINE_PTR(rettype, name) rettype (*name)

#if defined(__BORLANDC__) || defined(__WATCOMC__) || \
    defined(__POCC__) || defined(_MSC_VER) || defined(WIN32) || defined(_WIN32)
/* these compilers have a fastcall so use it: */
#  define N_NIMCALL(rettype, name) rettype __fastcall name
#  define N_NIMCALL_PTR(rettype, name) rettype (__fastcall *name)
#else
#  define N_NIMCALL(rettype, name) rettype name /* no modifier */
#  define N_NIMCALL_PTR(rettype, name) rettype (*name)
#endif

#define N_CLOSURE(rettype, name) N_NIMCALL(rettype, name)
#define N_CLOSURE_PTR(rettype, name) N_NIMCALL_PTR(rettype, name)

/* ----------------------------------------------------------------------- */

#include <limits.h>
#include <stddef.h>

/* C99 compiler? */
#if (defined(__STD_VERSION__) && (__STD_VERSION__ >= 199901))
#  define HAVE_STDINT_H
#endif

#if defined(__LCC__) || defined(__DMC__) || defined(__POCC__)
#  define HAVE_STDINT_H
#endif

/* bool types (C++ has it): */
#ifdef __cplusplus
#  ifndef NIM_TRUE
#    define NIM_TRUE true
#  endif
#  ifndef NIM_FALSE
#    define NIM_FALSE false
#  endif
#  define NIM_BOOL bool
#  define NIM_NIL 0
struct NimException
{
  NimException(struct E_Base* exp, const char* msg): exp(exp), msg(msg) {}

  struct E_Base* exp;
  const char* msg;
};
#else
#  ifdef bool
#    define NIM_BOOL bool
#  else
  typedef unsigned char NIM_BOOL;
#  endif
#  ifndef NIM_TRUE
#    define NIM_TRUE ((NIM_BOOL) 1)
#  endif
#  ifndef NIM_FALSE
#    define NIM_FALSE ((NIM_BOOL) 0)
#  endif
#  define NIM_NIL ((void*)0) /* C's NULL is fucked up in some C compilers, so
                              the generated code does not rely on it anymore */
#endif

#if defined(__BORLANDC__) || defined(__DMC__) \
   || defined(__WATCOMC__) || defined(_MSC_VER)
typedef signed char NI8;
typedef signed short int NI16;
typedef signed int NI32;
/* XXX: Float128? */
typedef unsigned char NU8;
typedef unsigned short int NU16;
typedef unsigned __int64 NU64;
typedef __int64 NI64;
typedef unsigned int NU32;
#elif defined(HAVE_STDINT_H)
#  include <stdint.h>
typedef int8_t NI8;
typedef int16_t NI16;
typedef int32_t NI32;
typedef int64_t NI64;
typedef uint64_t NU64;
typedef uint8_t NU8;
typedef uint16_t NU16;
typedef uint32_t NU32;
#else
typedef signed char NI8;
typedef signed short int NI16;
typedef signed int NI32;
/* XXX: Float128? */
typedef unsigned char NU8;
typedef unsigned short int NU16;
typedef unsigned long long int NU64;
typedef long long int NI64;
typedef unsigned int NU32;
#endif

#ifdef NIM_INTBITS
#  if NIM_INTBITS == 64
typedef NI64 NI;
typedef NU64 NU;
#  elif NIM_INTBITS == 32
typedef NI32 NI;
typedef NU32 NU;
#  elif NIM_INTBITS == 16
typedef NI16 NI;
typedef NU16 NU;
#  elif NIM_INTBITS == 8
typedef NI8 NI;
typedef NU8 NU;
#  else
#    error "invalid bit width for int"
#  endif
#endif

extern NI nim_program_result;

typedef float NF32;
typedef double NF64;
typedef double NF;

typedef char NIM_CHAR;
typedef char* NCSTRING;

#ifdef NIM_BIG_ENDIAN
#  define NIM_IMAN 1
#else
#  define NIM_IMAN 0
#endif

static N_INLINE(NI, float64ToInt32)(double x) {
  /* nowadays no hack necessary anymore */
  return x >= 0 ? (NI)(x+0.5) : (NI)(x-0.5);
}

static N_INLINE(NI32, float32ToInt32)(float x) {
  /* nowadays no hack necessary anymore */
  return x >= 0 ? (NI32)(x+0.5) : (NI32)(x-0.5);
}

#define float64ToInt64(x) ((NI64) (x))

#define zeroMem(a, size) memset(a, 0, size)
#define equalMem(a, b, size) (memcmp(a, b, size) == 0)

#define STRING_LITERAL(name, str, length) \
  static const struct {                   \
    TGenericSeq Sup;                      \
    NIM_CHAR data[(length) + 1];          \
  } name = {{length, length}, str}

typedef struct TStringDesc* string;

/* declared size of a sequence/variable length array: */
#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
#  define SEQ_DECL_SIZE /* empty is correct! */
#else
#  define SEQ_DECL_SIZE 1000000
#endif

#define ALLOC_0(size)  calloc(1, size)
#define DL_ALLOC_0(size) dlcalloc(1, size)

#define GenericSeqSize sizeof(TGenericSeq)
#define paramCount() cmdCount

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__i386__)
#  ifndef NAN
static unsigned long nimNaN[2]={0xffffffff, 0x7fffffff};
#    define NAN (*(double*) nimNaN)
#  endif
#endif

#ifndef NAN
#  define NAN (0.0 / 0.0)
#endif

#ifndef INF
#  ifdef INFINITY
#    define INF INFINITY
#  elif defined(HUGE_VAL)
#    define INF  HUGE_VAL
#  elif defined(_MSC_VER)
#    include <float.h>
#    define INF (DBL_MAX+DBL_MAX)
#  else
#    define INF (1.0 / 0.0)
#  endif
#endif

typedef struct TFrame TFrame;
struct TFrame {
  TFrame* prev;
  NCSTRING procname;
  NI line;
  NCSTRING filename;
  NI16 len;
  NI16 calldepth;
};

#define nimfr(proc, file) \
  TFrame F; \
  F.procname = proc; F.filename = file; F.line = 0; F.len = 0; nimFrame(&F);

#define nimfrs(proc, file, slots, length) \
  struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; TVarSlot s[slots];} F; \
  F.procname = proc; F.filename = file; F.line = 0; F.len = length; nimFrame((TFrame*)&F);

#define nimln(n, file) \
  F.line = n; F.filename = file;

#define NIM_POSIX_INIT  __attribute__((constructor)) 

#if defined(_MSCVER) && defined(__i386__)
__declspec(naked) int __fastcall NimXadd(volatile int* pNum, int val) {
  __asm {
    lock xadd dword ptr [ECX], EDX
    mov EAX, EDX
    ret
  }
}
#endif

#ifdef __GNUC__
#  define likely(x) __builtin_expect(x, 1)
#  define unlikely(x) __builtin_expect(x, 0)
/* We need the following for the posix wrapper. In particular it will give us
   POSIX_SPAWN_USEVFORK: */
#  ifndef _GNU_SOURCE
#    define _GNU_SOURCE
#  endif
#else
#  define likely(x) (x)
#  define unlikely(x) (x)
#endif

#if 0 // defined(__GNUC__) || defined(__clang__)
// not needed anymore because the stack marking cares about
// interior pointers now
static inline void GCGuard (void *ptr) { asm volatile ("" :: "X" (ptr)); }
#  define GC_GUARD __attribute__ ((cleanup(GCGuard)))
#else
#  define GC_GUARD
#endif

/* Test to see if nimrod and the C compiler agree on the size of a pointer.
   On disagreement, your C compiler will say something like: 
   "error: 'assert_numbits' declared as an array with a negative size" */
typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
#endif
cipient e.g. ``"buddy@chat.org"``, or ``None`` if not in a chat window. :rtype: str """ pass def get_current_muc(): """Retrieve the Jabber ID of the current room, when in a chat room window. :return: the Jabber ID of the current chat room e.g. ``"metalchat@conference.chat.org"``, or ``None`` if not in a chat room window. :rtype: str """ pass def get_current_nick(): """Retrieve the users nickname in a chat room, when in a chat room window. :return: the users nickname in the current chat room e.g. ``"eddie"``, or ``None`` if not in a chat room window. :rtype: str """ pass def get_name_from_roster(barejid): """Retrieve a nickname from a barejid if it is in the roster. :return: the users nickname e.g. "eddie", or the input barejid if it is not in the roster. :rtype: str """ pass def get_barejid_from_roster(name): """Retrieve the barejid for a given nickname if it is in the roster. :return: the users barejid e.g. "eddie@server.tld", or ``None`` if the nickname is not in the roster. :rtype: str """ pass def get_current_occupants(): """Retrieve nicknames of all occupants in a chat room, when in a chat room window. :return: nicknames of all occupants in the current room or an empty list if not in a chat room window. :rtype: list of str """ pass def get_room_nick(barejid): """Retrieve current nickname used in chat room. :return: Room nickname. :rtype: str """ pass def current_win_is_console(): """Determine whether or not the Console window is currently focused. :return: ``True`` if the user is currently in the Console window, ``False`` otherwise. :rtype: boolean """ pass def log_debug(message): """Write to the Profanity log at level ``DEBUG``. :param message: the message to log :type message: str or unicode """ pass def log_info(): """Write to the Profanity log at level ``INFO``. :param message: the message to log :type message: str or unicode """ pass def log_warning(): """Write to the Profanity log at level ``WARNING``. :param message: the message to log :type message: str or unicode """ pass def log_error(): """Write to the Profanity log at level ``ERROR``. :param message: the message to log :type message: str or unicode """ pass def win_exists(tag): """Determine whether or not a plugin window currently exists for the tag. :param tag: The tag used when creating the plugin window :type tag: str or unicode :return: ``True`` if the window exists, ``False`` otherwise. :rtype: boolean Example: :: prof.win_exists("My Plugin") """ pass def win_create(tag, callback): """Create a plugin window. :param tag: The tag used to refer to the window :type tag: str or unicode :param callback: function to call when the window receives input :type callback: function Example: :: prof.win_create("My Plugin", window_handler) """ pass def win_focus(tag): """Focus a plugin window. :param tag: The tag of the window to focus :type tag: str or unicode Example: :: prof.win_focus("My Plugin") """ pass def win_show(tag, message): """Show a message in the plugin window. :param tag: The tag of the window to display the message :type tag: str or unicode :param message: the message to print :type message: str or unicode Example: :: prof.win_show("My Plugin", "This will appear in the plugin window") """ pass def win_show_themed(tag, group, key, default, message): """Show a message in the plugin window, using the specified theme.\n Themes are specified in ``~/.local/share/profanity/plugin_themes`` :param tag: The tag of the window to display the message :type tag: str or unicode :param group: the group name in the themes file :param key: the item name within the group :param default: default colour if the theme cannot be found :param message: the message to print :type group: str, unicode or None :type key: str, unicode or None :type default: str, unicode or None :type message: str or unicode Example: :: prof.win_show_themed("My Plugin", "myplugin", "text", None, "Plugin themed message") """ pass def send_stanza(stanza): """Send an XMPP stanza :param stanza: An XMPP stanza :type stanza: str or unicode :return: ``True`` if the stanza was sent successfully, ``False`` otherwise :rtype: boolean Example: :: prof.send_stanza("<iq to='juliet@capulet.lit/balcony' id='s2c1' type='get'><ping xmlns='urn:xmpp:ping'/></iq>") """ pass def settings_boolean_get(group, key, default): """Get a boolean setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings`` :param group: the group name in the settings file :param key: the item name within the group :param default: default value if setting not found :type group: str or unicode :type key: str or unicode :type default: boolean Example: :: prof.settings_boolean_get("myplugin", "notify", False) """ pass def settings_boolean_set(group, key, value): """Set a boolean setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings`` :param group: the group name in the settings file :param key: the item name within the group :param value: value to set :type group: str or unicode :type key: str or unicode :type value: boolean Example: :: prof.settings_boolean_set("myplugin", "activate", True) """ pass def settings_string_get(group, key, default): """Get a string setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings`` :param group: the group name in the settings file :param key: the item name within the group :param default: default value if setting not found :type group: str or unicode :type key: str or unicode :type default: str Example: :: prof.settings_string_get("myplugin", "prefix", "prefix-->") """ pass def settings_string_set(group, key, value): """Set a string setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings`` :param group: the group name in the settings file :param key: the item name within the group :param value: value to set :type group: str or unicode :type key: str or unicode :type value: str Example: :: prof.settings_string_set("myplugin", "prefix", "myplugin, ") """ pass def settings_string_list_get(group, key): """Get a string list setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings``\n The string list setting items are separated by semicolons. :param group: the group name in the settings file :param key: the item name within the group :type group: str or unicode :type key: str or unicode :return: the list setting :rtype: list of str or unicode Example: :: prof.settings_string_list_get("someplugin", "somelist") """ pass def settings_string_list_add(group, key, value): """Add an item to a string list setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings``\n If the list does not exist, a new one will be created with the element added :param group: the group name in the settings file :param key: the item name within the group :param value: item to add :type group: str or unicode :type key: str or unicode :type value: str Example: :: prof.settings_string_list_add("someplugin", "somelist", "anelement") """ pass def settings_string_list_remove(group, key, value): """Remove an item from a string list setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings``\n :param group: the group name in the settings file :param key: the item name within the group :param value: item to remove :type group: str or unicode :type key: str or unicode :type value: str :return: ``True`` if the item was removed, or is not in the list, ``False`` if the list does not exist :rtype: boolean Example: :: prof.settings_string_list_remove("someplugin", "somelist", "anelement") """ pass def settings_string_list_clear(group, key): """Remove all items from a string list setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings``\n :param group: the group name in the settings file :param key: the item name within the group :type group: str or unicode :type key: str or unicode :return: ``True`` if the list was cleared, ``False`` if the list does not exist :rtype: boolean Example: :: prof.settings_string_list_clear("someplugin", "somelist") """ pass def settings_int_get(group, key, default): """Get an integer setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings`` :param group: the group name in the settings file :param key: the item name within the group :param default: default value if setting not found :type group: str or unicode :type key: str or unicode :type default: int Example: :: prof.settings_int_get("myplugin", "timeout", 10) """ pass def settings_int_set(group, key, value): """Set an integer setting\n Settings must be specified in ``~/.local/share/profanity/plugin_settings`` :param group: the group name in the settings file :param key: the item name within the group :param value: value to set :type group: str or unicode :type key: str or unicode :type value: int Example: :: prof.settings_int_set("myplugin", "timeout", 100) """ pass def incoming_message(barejid, resource, message): """Trigger incoming message handling, this plugin will make profanity act as if the message has been received :param barejid: Jabber ID of the sender of the message :param resource: resource of the sender of the message :param message: the message text :type barejid: str or unicode :type resource: str or unicode :type message: str or unicode Example: :: prof.incoming_message("bob@server.org", "laptop", "Hello there") """ pass def disco_add_feature(feature): """Add a service discovery feature the list supported by Profanity.\n If a session is already connected, a presence update will be sent to allow any client/server caches to update their feature list for Profanity :param feature: the service discovery feature to be added :type feature: str Example: :: prof.disco_add_feature("urn:xmpp:omemo:0:devicelist+notify") """ pass def encryption_reset(barejid): """End any encrypted session with the specified user :param barejid: Jabber ID of the recipient :type barejid: str or unicode Example: :: prof.encryption_reset("alice@server.org") """ pass def chat_set_titlebar_enctext(barejid, enctext): """Set the text to display in the titlebar encryption indicator for recipient. :param barejid: Jabber ID of the recipient :param enctext: The text to display :type barejid: str or unicode :type enctext: str or unicode :return: ``True`` if the text was set successfully, ``False`` otherwise :rtype: boolean Example: :: prof.chat_set_titlebar_enctext("bob@chat.org", "safe") """ pass def chat_unset_titlebar_enctext(barejid): """Let profanity decide what to show in the titlebar encryption indicator for recipient. :param barejid: Jabber ID of the recipient :type barejid: str or unicode :return: ``True`` if the text was unset successfully, ``False`` otherwise :rtype: boolean Example: :: prof.chat_unset_titlebar_enctext("bob@chat.org") """ pass def chat_set_incoming_char(barejid, ch): """Set the incoming message prefix character for specified contact. :param barejid: Jabber ID of the recipient :param enctext: The character to display :type barejid: str or unicode :type enctext: str or unicode :return: ``True`` if the character was set successfully, ``False`` otherwise :rtype: boolean Example: :: prof.chat_set_incoming_char("kristine@chat.org", "*") """ pass def chat_unset_incoming_char(barejid): """Reset the incoming message prefix character for specified contact. :param barejid: Jabber ID of the recipient :type barejid: str or unicode :return: ``True`` if the char was unset successfully, ``False`` otherwise :rtype: boolean Example: :: prof.chat_unset_incoming_char("kristine@chat.org") """ pass def chat_set_outgoing_char(barejid, ch): """Set the outgoing message prefix character for specified contact. :param barejid: Jabber ID of the recipient :param enctext: The character to display :type barejid: str or unicode :type enctext: str or unicode :return: ``True`` if the character was set successfully, ``False`` otherwise :rtype: boolean Example: :: prof.chat_set_outgoing_char("david@chat.org", "+") """ pass def chat_unset_outgoing_char(barejid): """Reset the outgoing message prefix character for specified contact. :param barejid: Jabber ID of the recipient :type barejid: str or unicode :return: ``True`` if the char was unset successfully, ``False`` otherwise :rtype: boolean Example: :: prof.chat_unset_outgoing_char("david@chat.org") """ pass def room_set_titlebar_enctext(roomjid, enctext): """Set the text to display in the titlebar encryption indicator for room. :param roomjid: Jabber ID of the room :param enctext: The text to display :type roomjid: str or unicode :type enctext: str or unicode :return: ``True`` if the text was set successfully, ``False`` otherwise :rtype: boolean Example: :: prof.room_set_titlebar_enctext("generalchat@conference.service.com", "secret") """ pass def room_unset_titlebar_enctext(roomjid): """Let profanity decide what to show in the titlebar encryption indicator for room. :param roomjid: Jabber ID of the room :type roomjid: str or unicode :return: ``True`` if the text was unset successfully, ``False`` otherwise :rtype: boolean Example: :: prof.room_unset_titlebar_enctext("generalchat@conference.service.com") """ pass def room_set_message_char(roomjid, ch): """Set the message prefix character for specified room. :param roomjid: Jabber ID of the room :param enctext: The character to display :type roomjid: str or unicode :type enctext: str or unicode :return: ``True`` if the character was set successfully, ``False`` otherwise :rtype: boolean Example: :: prof.room_set_message_char("ohnoes@conference.chat.org", "^") """ pass def room_unset_message_char(roomjid): """Reset the message prefix character for specified room. :param roomjid: Jabber ID of the room :type roomjid: str or unicode :return: ``True`` if the char was unset successfully, ``False`` otherwise :rtype: boolean Example: :: prof.room_unset_message_char("ohnoes@conference.chat.org") """ pass def chat_show(barejid, message): """Show a message in a chat window. :param barejid: Jabber ID of the recipient :param message: the message to print :type barejid: str or unicode :type message: str or unicode :return: ``True`` if the message was printed, ``False`` otherwise :rtype: boolean Example: :: prof.chat_show("bob@server.org", "From a plugin in the chat window for bob") """ pass def chat_show_themed(barejid, group, key, default, ch, message): """Show a message a chat window, using the specified theme and prefix character.\n Themes are specified in ``~/.local/share/profanity/plugin_themes`` :param barejid: Jabber ID of the recipient :param group: the group name in the themes file or ``None`` :param key: the item name within the group or ``None`` :param default: default colour if the theme cannot be found or ``None`` :param ch: The prefix character to show, or ``None`` for default behaviour :param message: the message to print :type barejid: str or unicode :type group: str, unicode or None :type key: str, unicode or None :type default: str, unicode or None :type ch: str or unicode :type message: str or unicode :return: ``True`` if the message was printed, ``False`` otherwise :rtype: boolean Example: :: prof.chat_show_themed("bob@server.org", "myplugin", "text", None, "!", "Plugin themed message") """ pass def room_show(roomjid, message): """Show a message in a chat room window. :param roomjid: Jabber ID of the room :param message: the message to print :type roomjid: str or unicode :type message: str or unicode :return: ``True`` if the message was printed, ``False`` otherwise :rtype: boolean Example: :: prof.room_show("chat@conference.chat.org", "From a plugin in the chat room window") """ pass def room_show_themed(roomjid, group, key, default, ch, message): """Show a message a chat room window, using the specified theme and prefix character.\n Themes are specified in ``~/.local/share/profanity/plugin_themes`` :param roomjid: Jabber ID of the room :param group: the group name in the themes file or ``None`` :param key: the item name within the group or ``None`` :param default: default colour if the theme cannot be found or ``None`` :param ch: The prefix character to show, or ``None`` for default behaviour :param message: the message to print :type roomjid: str or unicode :type group: str, unicode or None :type key: str, unicode or None :type default: str, unicode or None :type ch: str or unicode :type message: str or unicode :return: ``True`` if the message was printed, ``False`` otherwise :rtype: boolean Example: :: prof.room_show_themed("chat@conference.chat.org", "myplugin", "text", None, "!", "Plugin themed message") """ pass