-int list (const char *name, const struct stat *status, int type) {
-
- GList *files = NULL;
- FILE *curlog;
- char curline[1024];
- char *match = NULL;
- char answer[1024], *answer_body, *tmp_ptr;
- char *me; //, *me_end;
- int me_length;
- int current_number_of_answers = g_list_length(answers);
-
- if (type == FTW_NS) return 0;
- if (type == FTW_F) {
- /* purple_debug_misc("auto-answer-history DEBUG", "%-30s\t0%3o\n", name, status->st_mode&0777); */
- files = g_list_append(files, (gpointer) name);
- }
-/* else {
- purple_debug_misc("auto-answer-history DEBUG", "Logdir is: %-30s*\t0%3o\n", name, status->st_mode&0777);
- purple_debug_misc("auto-answer-history DEBUG", "Going to find \"%s\" from buddy %s (%s)\n", buff, buddyname1, buddyname1_alias);
- }*/
-
- if (username_alias != NULL) me = username_alias;
- else me = username;
-
- me_length=strlen(me);
-
- while(files) {
- /* purple_debug_misc("auto-answer-history DEBUG", "Processing... %s\n", files->data); */
- if ((curlog = fopen(files->data, "r")) != NULL) {
- while (fgets(curline, sizeof curline, curlog) != NULL) {
- if ( ((strstr(curline, buff)) != NULL) && ((strstr(curline, me)) == NULL)) {
- match = strstr(curline, buff);
- /* purple_debug_misc("auto-answer-history DEBUG", "FOUND in %s, line %d, looking for answer...\n", files->data, counter); */
- while (fgets(answer, sizeof answer, curlog) !=NULL ) {
- if ((strstr(answer, me)) != NULL) {
- if (purple_markup_strip_html(answer) != NULL) {
- if (current_number_of_answers>limit_of_answers)
- { fclose(curlog);
- return 0;
- }
- /* check if such answer isn't already in a GList */
-
- answer_body=purple_markup_strip_html(answer);
- tmp_ptr=strchr(answer_body,':')+1; tmp_ptr=strchr(tmp_ptr,':')+1;
- tmp_ptr=strchr(tmp_ptr,':')+1; /*skip 3 semi-colons in the preface*/
-
- answer_body=strstr(answer_body,me)+me_length+1; /*skip preface*/
- if (tmp_ptr > answer_body) answer_body = tmp_ptr; /* choose the better method of preface skip*/
-
- if (!g_list_find_custom(answers,answer_body,compare_str))
- { g_list_append (answers, answer_body);
- current_number_of_answers++;
- }
-
- }
- break;
- }
- }
- }
- }
- }
- fclose(curlog);
- files = files->next;
- }
- return 0;
-}
-
-static void
-send_combo_cb(GtkWidget *widget, PidginConversation *gtkconv)
-{ /* A button to send item from combobox was pressed */
- GtkIMHtmlOptions options;
- GtkWidget *send_combo;
- gchar *text, *pref_prompt;
- gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry));
-/* if (purple_prefs_get_bool(PREF_ROBOT))
- {*/ /*gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), _("The possible answer is:<B>"), options);*/
- pref_prompt=purple_prefs_get_string(PREF_PROMPT);
- if (strlen(pref_prompt)>0)
- { gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), pref_prompt, options);
- gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), "<B>", options);
- }
-// purple_debug_misc("auto-answer-history DEBUG", "the prompt was \"%d\"", strlen(pref_prompt));
-
-/* }*/
- send_combo = g_object_get_data(G_OBJECT(gtkconv->toolbar), "send_combo");
- text=gtk_combo_box_get_active_text(GTK_COMBO_BOX(send_combo));
- gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), text, options);
- g_free(text);
- g_signal_emit_by_name(gtkconv->entry, "message_send");
-}