57 nextrep = currep->
next;
68 nextrep = currep->
next;
86 static int matches(
const char *exp,
const char *text) {
87 char *pipe, *save, *msg;
117 char *current, *save, *msg, *cp;
132 msg = strdup(op->
msg);
133 current =
strtok_r(msg,
"\n", &save);
136 if (strncmp(current,
"@match ", 7) == 0) {
145 last->
next = message;
150 message->
match = strdup(current+7);
151 }
else if ((strncmp(current,
"@reply ", 7) == 0 && (len = 7)) || (strncmp(current,
"@question ", 10) == 0 && (len = 10))) {
155 cp = strchr(current+len,
' ');
158 reply->
reply = strdup(current+len);
161 reply->
reply = strdup(current+len);
163 LOG(
llevDebug,
"Warning: @reply/@question without message for %s!\n", op->
name);
176 }
else if (message) {
179 tmplen += strlen(current)+2;
182 tmp = realloc(tmp, tmplen*
sizeof(
char));
187 strncat(tmp, current, tmplen-strlen(tmp)-1);
188 strncat(tmp,
"\n", tmplen-strlen(tmp)-1);
190 current =
strtok_r(NULL,
"\n", &save);
219 if (
matches((*message)->match, text)) {
227 if (strcmp((*reply)->reply, text) == 0)
int get_dialog_message(object *op, const char *text, struct_dialog_message **message, struct_dialog_reply **reply)
static void parse_dialog_information(object *op)
void free_dialog_information(object *op)
struct struct_dialog_message * next
#define strtok_r(x, y, z)
static int matches(const char *exp, const char *text)
const char * re_cmp(const char *, const char *)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
struct struct_dialog_information * dialog_information
struct struct_dialog_reply * replies
void LOG(LogLevel logLevel, const char *format,...)
#define FLAG_DIALOG_PARSED
struct struct_dialog_reply * next