Sat, 12 Nov 2005 16:55:47 +0000
[gaim-migrate @ 14349]
oops, didn't mean to commit that
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZFormatSmallRawNoticeList function. | |
| 3 | * | |
| 4 | * Created by: John T. Kohl | |
| 5 | * | |
| 6 | * Copyright (c) 1988 by the Massachusetts Institute of Technology. | |
| 7 | * For copying and distribution information, see the file | |
| 8 | * "mit-copyright.h". | |
| 9 | */ | |
| 10 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
11 | #include "internal.h" |
| 2086 | 12 | |
| 13 | Code_t ZFormatSmallRawNoticeList(notice, list, nitems, buffer, ret_len) | |
| 14 | ZNotice_t *notice; | |
| 15 | char *list[]; | |
| 16 | int nitems; | |
| 17 | ZPacket_t buffer; | |
| 18 | int *ret_len; | |
| 19 | { | |
| 20 | Code_t retval; | |
| 21 | int hdrlen, i, size; | |
| 22 | char *ptr; | |
| 23 | ||
| 24 | if ((retval = Z_FormatRawHeader(notice, buffer, Z_MAXHEADERLEN, | |
| 25 | &hdrlen, NULL, NULL)) != ZERR_NONE) | |
| 26 | return (retval); | |
| 27 | ||
| 28 | size = 0; | |
| 29 | for (i=0;i<nitems;i++) | |
| 30 | size += strlen(list[i])+1; | |
| 31 | ||
| 32 | *ret_len = hdrlen+size; | |
| 33 | ||
| 34 | if (*ret_len > Z_MAXPKTLEN) | |
| 35 | return (ZERR_PKTLEN); | |
| 36 | ||
| 37 | ptr = buffer+hdrlen; | |
| 38 | ||
| 39 | for (;nitems;nitems--, list++) { | |
| 40 | i = strlen(*list)+1; | |
| 41 | (void) memcpy(ptr, *list, i); | |
| 42 | ptr += i; | |
| 43 | } | |
| 44 | ||
| 45 | return (ZERR_NONE); | |
| 46 | } |