| 1 | /* Copyright (c) 2002,2003,2004,2009 James M. Kretchmar |
|---|
| 2 | * |
|---|
| 3 | * This file is part of Owl. |
|---|
| 4 | * |
|---|
| 5 | * Owl is free software: you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * Owl is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with Owl. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | * |
|---|
| 18 | * --------------------------------------------------------------- |
|---|
| 19 | * |
|---|
| 20 | * As of Owl version 2.1.12 there are patches contributed by |
|---|
| 21 | * developers of the branched BarnOwl project, Copyright (c) |
|---|
| 22 | * 2006-2009 The BarnOwl Developers. All rights reserved. |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | #include "owl.h" |
|---|
| 26 | |
|---|
| 27 | void owl_errqueue_init(owl_errqueue *eq) |
|---|
| 28 | { |
|---|
| 29 | owl_list_create(&(eq->errlist)); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | void owl_errqueue_append_err(owl_errqueue *eq, char *msg) |
|---|
| 33 | { |
|---|
| 34 | owl_list_append_element(&(eq->errlist), owl_strdup(msg)); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | /* fmtext should already be initialized */ |
|---|
| 38 | void owl_errqueue_to_fmtext(owl_errqueue *eq, owl_fmtext *fm) |
|---|
| 39 | { |
|---|
| 40 | int i, j; |
|---|
| 41 | |
|---|
| 42 | j=owl_list_get_size(&(eq->errlist)); |
|---|
| 43 | for (i=0; i<j; i++) { |
|---|
| 44 | owl_fmtext_append_normal(fm, owl_list_get_element(&(eq->errlist), i)); |
|---|
| 45 | owl_fmtext_append_normal(fm, "\n"); |
|---|
| 46 | } |
|---|
| 47 | } |
|---|