Mercurial > pidgin
annotate src/protocols/zephyr/ZFmtList.c @ 9912:f6a1054e2bdc
[gaim-migrate @ 10804]
" shadow pointed that zephyr_strip_foreign_realm wasn't
being consistently used (searches for foo would fail
when foo@DEFAULTREALM was in the buddy list), and that
this could cause problems.
Also, zephyr_strip_foreign_realm was really badly named
(it should be zephyr_strip_local_realm).
Here's a fix for both those issues, against current cvs." --Arun A Tharuvai
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 30 Aug 2004 01:52:59 +0000 |
parents | 43d6c08d7e96 |
children | 64895571248f |
rev | line source |
---|---|
2086 | 1 /* This file is part of the Project Athena Zephyr Notification System. |
2 * It contains source for the ZFormatNoticeList function. | |
3 * | |
4 * Created by: Robert French | |
5 * | |
6 * $Source$ | |
8792
43d6c08d7e96
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
7 * $Author: chipx86 $ |
2086 | 8 * |
9 * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. | |
10 * For copying and distribution information, see the file | |
11 * "mit-copyright.h". | |
12 */ | |
13 /* $Header$ */ | |
14 | |
8792
43d6c08d7e96
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
15 #include "internal.h" |
2086 | 16 |
17 #ifndef lint | |
18 static const char rcsid_ZFormatNoticeList_c[] = | |
8792
43d6c08d7e96
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
19 "$Id: ZFmtList.c 9554 2004-04-24 09:02:28Z chipx86 $"; |
2086 | 20 #endif |
21 | |
22 Code_t ZFormatNoticeList(notice, list, nitems, buffer, ret_len, | |
23 cert_routine) | |
24 ZNotice_t *notice; | |
25 register char **list; | |
26 int nitems; | |
27 char **buffer; | |
28 int *ret_len; | |
29 Z_AuthProc cert_routine; | |
30 { | |
31 char header[Z_MAXHEADERLEN]; | |
32 register int i; | |
33 int hdrlen, size; | |
34 char *ptr; | |
35 Code_t retval; | |
36 | |
37 if ((retval = Z_FormatHeader(notice, header, sizeof(header), &hdrlen, | |
38 cert_routine)) != ZERR_NONE) | |
39 return (retval); | |
40 | |
41 size = 0; | |
42 for (i=0;i<nitems;i++) | |
43 size += strlen(list[i])+1; | |
44 | |
45 *ret_len = hdrlen+size; | |
46 | |
47 /* *ret_len can never be zero here, no need to worry about malloc(0). */ | |
48 if (!(*buffer = (char *) malloc((unsigned)*ret_len))) | |
49 return (ENOMEM); | |
50 | |
51 (void) memcpy(*buffer, header, hdrlen); | |
52 | |
53 ptr = *buffer+hdrlen; | |
54 | |
55 for (;nitems;nitems--, list++) { | |
56 i = strlen(*list)+1; | |
57 (void) memcpy(ptr, *list, i); | |
58 ptr += i; | |
59 } | |
60 | |
61 return (ZERR_NONE); | |
62 } |