Mercurial > pidgin.yaz
annotate src/protocols/zephyr/ZCkIfNot.c @ 13284:8d0c909ac2d9
[gaim-migrate @ 15650]
Common English mistakes.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 14 Feb 2006 07:54:51 +0000 |
parents | 64895571248f |
children |
rev | line source |
---|---|
2086 | 1 /* This file is part of the Project Athena Zephyr Notification System. |
2 * It contains source for the ZCheckIfNotice function. | |
3 * | |
4 * Created by: Robert French | |
5 * | |
6 * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. | |
7 * For copying and distribution information, see the file | |
8 * "mit-copyright.h". | |
9 */ | |
10 | |
8792
43d6c08d7e96
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
11 #include "internal.h" |
2086 | 12 |
13 Code_t ZCheckIfNotice(notice, from, predicate, args) | |
14 ZNotice_t *notice; | |
15 struct sockaddr_in *from; | |
16 register int (*predicate) __P((ZNotice_t *, void *)); | |
17 void *args; | |
18 { | |
19 ZNotice_t tmpnotice; | |
20 Code_t retval; | |
21 register char *buffer; | |
22 register struct _Z_InputQ *qptr; | |
23 | |
24 if ((retval = Z_ReadEnqueue()) != ZERR_NONE) | |
25 return (retval); | |
26 | |
27 qptr = Z_GetFirstComplete(); | |
28 | |
29 while (qptr) { | |
30 if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, | |
31 &tmpnotice)) != ZERR_NONE) | |
32 return (retval); | |
33 if ((*predicate)(&tmpnotice, args)) { | |
34 if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) | |
35 return (ENOMEM); | |
36 (void) memcpy(buffer, qptr->packet, qptr->packet_len); | |
37 if (from) | |
38 *from = qptr->from; | |
39 if ((retval = ZParseNotice(buffer, qptr->packet_len, | |
40 notice)) != ZERR_NONE) { | |
41 free(buffer); | |
42 return (retval); | |
43 } | |
44 Z_RemQueue(qptr); | |
45 return (ZERR_NONE); | |
46 } | |
47 qptr = Z_GetNextComplete(qptr); | |
48 } | |
49 | |
50 return (ZERR_NONOTICE); | |
51 } |