00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __EKG_PROTOCOL_H
00021 #define __EKG_PROTOCOL_H
00022
00023 #include "ekg2-config.h"
00024
00025 #include "dynstuff.h"
00026 #include "sessions.h"
00027 #include <stdarg.h>
00028 #include <stdint.h>
00029 #include <time.h>
00030 #include <stdlib.h>
00031 #include <sys/types.h>
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037 #define EKG_FORMAT_RGB_MASK 0x00ffffffL
00038 #define EKG_FORMAT_R_MASK 0x00ff0000L
00039 #define EKG_FORMAT_G_MASK 0x0000ff00L
00040 #define EKG_FORMAT_B_MASK 0x000000ffL
00041 #define EKG_FORMAT_COLOR 0x01000000L
00042 #define EKG_FORMAT_BOLD 0x02000000L
00043 #define EKG_FORMAT_ITALIC 0x04000000L
00044 #define EKG_FORMAT_UNDERLINE 0x08000000L
00045 #define EKG_FORMAT_REVERSE 0x10000000L
00046
00047 #define EKG_NO_THEMEBIT 256
00048
00049 enum msgack_t {
00050 EKG_ACK_DELIVERED = 0,
00051 EKG_ACK_QUEUED,
00052 EKG_ACK_DROPPED,
00053 EKG_ACK_TEMPFAIL,
00054 EKG_ACK_UNKNOWN,
00055
00056 EKG_ACK_MAX
00057 };
00058
00059 typedef enum {
00060 EKG_DISCONNECT_USER = 0,
00061 EKG_DISCONNECT_NETWORK,
00062 EKG_DISCONNECT_FORCED,
00063 EKG_DISCONNECT_FAILURE,
00064 EKG_DISCONNECT_STOPPED
00065 } disconnect_t;
00066
00067 #define EKG_NO_BEEP 0
00068 #define EKG_TRY_BEEP 1
00069
00070 typedef enum {
00071
00072 EKG_MSGCLASS_MESSAGE = 0,
00073 EKG_MSGCLASS_CHAT,
00074 EKG_MSGCLASS_SYSTEM,
00075 EKG_MSGCLASS_LOG,
00076
00077 EKG_MSGCLASS_NOT2US = 16,
00078
00079
00080 EKG_MSGCLASS_SENT = 32,
00081 EKG_MSGCLASS_SENT_CHAT,
00082 EKG_MSGCLASS_SENT_LOG,
00083
00084 EKG_MSGCLASS_PRIV_STATUS= 64
00085 } msgclass_t;
00086
00087 #ifndef EKG2_WIN32_NOFUNCTION
00088 void protocol_init();
00089
00090 char *message_print(const char *session, const char *sender, const char **rcpts, const char *text, const uint32_t *format,
00091 time_t sent, int mclass, const char *seq, int dobeep, int secure);
00092
00093 int protocol_connected_emit(const session_t *s);
00094 int protocol_disconnected_emit(const session_t *s, const char *reason, int type);
00095 int protocol_message_ack_emit(const session_t *s, const char *rcpt, const char *seq, int status);
00096 int protocol_message_emit(const session_t *s, const char *uid, char **rcpts, const char *text, const uint32_t *format, time_t sent, int mclass, const char *seq, int dobeep, int secure);
00097 int protocol_status_emit(const session_t *s, const char *uid, int status, char *descr, time_t when);
00098 int protocol_xstate_emit(const session_t *s, const char *uid, int state, int offstate);
00099
00100 char *protocol_uid(const char *proto, const char *target);
00101 #endif
00102
00103 typedef enum {
00104 DCC_NONE = 0,
00105 DCC_SEND,
00106 DCC_GET,
00107 DCC_VOICE
00108 } dcc_type_t;
00109
00110 struct dcc_s;
00111
00112 typedef void (*dcc_close_handler_t)(struct dcc_s *);
00113
00114 typedef struct dcc_s {
00115 struct dcc_s *next;
00116
00117 session_t *session;
00118 char *uid;
00119 dcc_type_t type;
00120 int id;
00121 void *priv;
00122 dcc_close_handler_t close_handler;
00123 unsigned int active : 1;
00124 time_t started;
00125
00126 char *filename;
00127 size_t size;
00128 off_t offset;
00129 } dcc_t;
00130
00131 #ifndef EKG2_WIN32_NOFUNCTION
00132 dcc_t *dcc_add(session_t *session, const char *uid, dcc_type_t type, void *priv);
00133 int dcc_close(dcc_t *d);
00134
00135 int dcc_private_set(dcc_t *, void *);
00136 void *dcc_private_get(dcc_t *);
00137 int dcc_close_handler_set(dcc_t *, dcc_close_handler_t);
00138 dcc_close_handler_t dcc_close_handler_get(dcc_t *);
00139 const char *dcc_uid_get(dcc_t *);
00140 int dcc_id_get(dcc_t *);
00141 time_t dcc_started_get(dcc_t *);
00142 int dcc_active_set(dcc_t *, int);
00143 int dcc_active_get(dcc_t *);
00144 int dcc_offset_set(dcc_t *, int);
00145 int dcc_offset_get(dcc_t *);
00146 int dcc_size_set(dcc_t *, int);
00147 int dcc_size_get(dcc_t *);
00148 int dcc_filename_set(dcc_t *, const char *);
00149 const char *dcc_filename_get(dcc_t *);
00150 dcc_type_t dcc_type_get(dcc_t *);
00151
00152 extern dcc_t *dccs;
00153
00154 #endif
00155
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159
00160 #endif
00161
00162
00163
00164
00165
00166
00167
00168
00169