comparison libpurple/protocols/zephyr/ZCkIfNot.c @ 15373:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children a8cc50c2279f
comparison
equal deleted inserted replaced
15372:f79e0f4df793 15373:5fe8042783c1
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
11 #include "internal.h"
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 }