Mercurial > pidgin
annotate src/protocols/zephyr/ZPeekIfNot.c @ 12264:2be62353f708
[gaim-migrate @ 14566]
this was TRUE in oldstatus
committer: Tailor Script <tailor@pidgin.im>
| author | Nathan Walp <nwalp@pidgin.im> |
|---|---|
| date | Tue, 29 Nov 2005 23:50:39 +0000 |
| parents | 64895571248f |
| children | 7c2e2c4d45a4 |
| rev | line source |
|---|---|
| 2086 | 1 /* This file is part of the Project Athena Zephyr Notification System. |
| 2 * It contains source for the ZPeekIfNotice 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 ZPeekIfNotice(notice, from, predicate, args) | |
| 14 ZNotice_t *notice; | |
| 15 struct sockaddr_in *from; | |
| 16 int (*predicate)(); | |
| 17 char *args; | |
| 18 { | |
| 19 ZNotice_t tmpnotice; | |
| 20 Code_t retval; | |
| 21 char *buffer; | |
| 22 struct _Z_InputQ *qptr; | |
| 23 | |
| 24 if ((retval = Z_WaitForComplete()) != ZERR_NONE) | |
| 25 return (retval); | |
| 26 | |
| 27 for (;;) { | |
| 28 qptr = Z_GetFirstComplete(); | |
| 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 return (ZERR_NONE); | |
| 45 } | |
| 46 qptr = Z_GetNextComplete(qptr); | |
| 47 } | |
| 48 if ((retval = Z_ReadWait()) != ZERR_NONE) | |
| 49 return (retval); | |
| 50 } | |
| 51 } |
