1 /****h* silccore/silcnotify.h
9 * Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
11 * Copyright (C) 1997 - 2000 Pekka Riikonen
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
25 * Implementation of the Notify Payload. Notify Payload is used usually
26 * servers to send different kind of important notify messages to other
27 * servers and to clients.
34 /****s* silccore/SilcNotifyAPI/SilcNotifyPayload
38 * typedef struct SilcNotifyPayloadStruct *SilcNotifyPayload;
42 * This context is the actual Notify Payload and is allocated
43 * by silc_notify_payload_parse and given as argument usually to
44 * all silc_notify_payload_* functions. It is freed by the
45 * silc_notify_payload_free function.
48 typedef struct SilcNotifyPayloadStruct *SilcNotifyPayload;
50 /****d* silccore/SilcNotifyAPI/SilcNotifyType
54 * typedef uint16 SilcNotifyType;
58 * The notify type definition and all of the notify types.
62 typedef uint16 SilcNotifyType;
64 /* SILC notify types. Server may send these notify types to client to
65 notify of some action. */
66 #define SILC_NOTIFY_TYPE_NONE 0 /* no specific type */
67 #define SILC_NOTIFY_TYPE_INVITE 1 /* invites/invite list change */
68 #define SILC_NOTIFY_TYPE_JOIN 2 /* "has joined channel" */
69 #define SILC_NOTIFY_TYPE_LEAVE 3 /* "has left channel" */
70 #define SILC_NOTIFY_TYPE_SIGNOFF 4 /* "signoff" */
71 #define SILC_NOTIFY_TYPE_TOPIC_SET 5 /* "topic has been changed" */
72 #define SILC_NOTIFY_TYPE_NICK_CHANGE 6 /* "has changed nickname" */
73 #define SILC_NOTIFY_TYPE_CMODE_CHANGE 7 /* "has changed channel mode" */
74 #define SILC_NOTIFY_TYPE_CUMODE_CHANGE 8 /* "has change mode" */
75 #define SILC_NOTIFY_TYPE_MOTD 9 /* message of the day */
76 #define SILC_NOTIFY_TYPE_CHANNEL_CHANGE 10 /* Channel's ID has changed */
77 #define SILC_NOTIFY_TYPE_SERVER_SIGNOFF 11 /* Server quitting SILC */
78 #define SILC_NOTIFY_TYPE_KICKED 12 /* Kicked from channel */
79 #define SILC_NOTIFY_TYPE_KILLED 13 /* Killed from the network */
80 #define SILC_NOTIFY_TYPE_UMODE_CHANGE 14 /* user mode was changed */
81 #define SILC_NOTIFY_TYPE_BAN 15 /* ban list change */
86 /****f* silccore/SilcNotifyAPI/silc_notify_payload_parse
90 * SilcNotifyPayload silc_notify_payload_parse(SilcBuffer buffer);
94 * Parse notify payload buffer and return data into payload structure.
95 * The `buffer' is the raw payload data.
98 SilcNotifyPayload silc_notify_payload_parse(SilcBuffer buffer);
100 /****f* silccore/SilcNotifyAPI/silc_notify_payload_encode
104 * SilcBuffer silc_notify_payload_encode(SilcNotifyType type, uint32 argc,
109 * Encode notify payload with variable argument list. If `argc' is > 0
110 * argument payloads will be associated to the notify payload. Variable
111 * arguments must be {usigned char *, uint32 (len)}.
114 SilcBuffer silc_notify_payload_encode(SilcNotifyType type, uint32 argc,
117 /****f* silccore/SilcNotifyAPI/silc_notify_payload_encode_args
121 * SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
127 * Same as silc_notify_payload_encode but takes arguments from the `args'
128 * encoded Argument Payload buffer.
131 SilcBuffer silc_notify_payload_encode_args(SilcNotifyType type,
135 /****f* silccore/SilcNotifyAPI/silc_notify_payload_free
139 * void silc_notify_payload_free(SilcNotifyPayload payload);
143 * Frees the Notify Payload and all data in it.
146 void silc_notify_payload_free(SilcNotifyPayload payload);
148 /****f* silccore/SilcNotifyAPI/silc_notify_get_type
152 * SilcNotifyType silc_notify_get_type(SilcNotifyPayload payload);
156 * Return the notify type from the payload.
159 SilcNotifyType silc_notify_get_type(SilcNotifyPayload payload);
161 /****f* silccore/SilcNotifyAPI/silc_notify_get_arg_num
165 * uint32 silc_notify_get_arg_num(SilcNotifyPayload payload);
169 * Return the number of the arguments associated with the Notify Payload.
172 uint32 silc_notify_get_arg_num(SilcNotifyPayload payload);
174 /****f* silccore/SilcNotifyAPI/silc_notify_get_args
178 * SilcArgumentPayload silc_notify_get_args(SilcNotifyPayload payload);
182 * Return the Argument Payload containing the arguments from the
183 * Notify Payload. The caller must not free it.
186 SilcArgumentPayload silc_notify_get_args(SilcNotifyPayload payload);