Thu, 13 Feb 2020 20:57:31 -0600
Move the libidn check to jabber/meson.build as it needs specific functions of the library
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains the ZCheckIfNotice/select loop used for waiting for | |
| 3 | * a notice, with a timeout. | |
| 4 | * | |
| 5 | * Copyright (c) 1991 by the Massachusetts Institute of Technology. | |
| 6 | * For copying and distribution information, see the file | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
7 | * "mit-copyright.h". |
| 2086 | 8 | */ |
| 9 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
10 | #include "internal.h" |
| 10867 | 11 | |
| 12 | #ifdef WIN32 | |
| 13 | #include <winsock2.h> | |
| 14 | ||
| 15 | #ifndef ZEPHYR_USES_KERBEROS | |
| 16 | static int gettimeofday(struct timeval* tv, struct timezone* tz){ | |
| 17 | union { | |
| 18 | long long ns100; /*time since 1 Jan 1601 in 100ns units */ | |
| 19 | FILETIME ft; | |
| 20 | } _now; | |
| 21 | ||
| 22 | GetSystemTimeAsFileTime( &(_now.ft) ); | |
| 23 | tv->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); | |
| 24 | tv->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); | |
| 25 | return 0; | |
| 26 | } | |
| 27 | #endif | |
| 28 | ||
| 29 | #else | |
| 2086 | 30 | #include <sys/socket.h> |
| 10867 | 31 | #endif |
| 2086 | 32 | |
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39829
diff
changeset
|
33 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39829
diff
changeset
|
34 | Z_WaitForNotice(ZNotice_t *notice, int (*pred)(ZNotice_t *, void *), void *arg, |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39829
diff
changeset
|
35 | int timeout) |
| 2086 | 36 | { |
| 37 | Code_t retval; | |
| 38 | struct timeval tv, t0; | |
| 39 | fd_set fdmask; | |
| 40 | int i, fd; | |
| 41 | ||
| 42 | retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, | |
| 43 | (char *) arg); | |
| 44 | if (retval == ZERR_NONE) | |
| 45 | return ZERR_NONE; | |
| 46 | if (retval != ZERR_NONOTICE) | |
| 47 | return retval; | |
| 48 | ||
| 49 | fd = ZGetFD (); | |
| 50 | FD_ZERO (&fdmask); | |
| 51 | tv.tv_sec = timeout; | |
| 52 | tv.tv_usec = 0; | |
| 10867 | 53 | gettimeofday (&t0, (struct timezone *)NULL); |
| 2086 | 54 | t0.tv_sec += timeout; |
| 55 | while (1) { | |
| 56 | FD_SET (fd, &fdmask); | |
| 57 | i = select (fd + 1, &fdmask, (fd_set *) 0, (fd_set *) 0, &tv); | |
| 58 | if (i == 0) | |
| 59 | return ETIMEDOUT; | |
| 60 | if (i < 0 && errno != EINTR) | |
| 61 | return errno; | |
| 62 | if (i > 0) { | |
| 63 | retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, | |
| 64 | (char *) arg); | |
| 65 | if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */ | |
| 66 | return retval; | |
| 67 | } | |
| 10867 | 68 | gettimeofday (&tv, (struct timezone *) NULL); |
| 2086 | 69 | tv.tv_usec = t0.tv_usec - tv.tv_usec; |
| 70 | if (tv.tv_usec < 0) { | |
| 71 | tv.tv_usec += 1000000; | |
| 72 | tv.tv_sec = t0.tv_sec - tv.tv_sec - 1; | |
| 73 | } | |
| 74 | else | |
| 75 | tv.tv_sec = t0.tv_sec - tv.tv_sec; | |
| 76 | } | |
| 77 | /*NOTREACHED*/ | |
| 78 | } |