Thu, 27 May 2021 20:25:24 -0500
Change the default irc server to libera.chat
This seems to make the most sense for users right now as many many channels have migrated away from freenode with many of them moving to libera.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/675/
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZParseNotice function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. | |
| 7 | * For copying and distribution information, see the file | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
8 | * "mit-copyright.h". |
| 2086 | 9 | */ |
| 10 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
7475
diff
changeset
|
11 | #include "internal.h" |
| 2086 | 12 | |
| 13 | /* Assume that strlen is efficient on this machine... */ | |
| 14 | #define next_field(ptr) ptr += strlen (ptr) + 1 | |
| 15 | ||
| 16 | #if defined (__GNUC__) && defined (__vax__) | |
| 17 | #undef next_field | |
| 18 | static __inline__ char * Istrend (char *str) { | |
| 19 | /* | |
| 20 | * This should be faster on VAX models outside the 2 series. Don't | |
| 21 | * use it if you are using MicroVAX 2 servers. If you are using a | |
| 22 | * VS2 server, use something like | |
| 23 | * #define next_field(ptr) while(*ptr++) | |
| 24 | * instead of this code. | |
| 25 | * | |
| 26 | * This requires use of GCC to get the optimized code, but | |
| 27 | * everybody uses GCC, don't they? :-) | |
| 28 | */ | |
| 29 | register char *str2 asm ("r1"); | |
| 30 | /* Assumes that no field is longer than 64K.... */ | |
| 31 | asm ("locc $0,$65535,(%1)" : "=r" (str2) : "r" (str) : "r0"); | |
| 32 | return str2; | |
| 33 | } | |
| 34 | #define next_field(ptr) ptr = Istrend (ptr) + 1 | |
| 35 | #endif | |
| 36 | ||
| 37 | #ifdef mips | |
| 38 | #undef next_field | |
| 39 | /* | |
| 40 | * The compiler doesn't optimize this macro as well as it does the | |
| 41 | * following function. | |
| 42 | */ | |
| 43 | #define next_fieldXXX(ptr) do{register unsigned c1,c2;c1= *ptr; \ | |
| 44 | while((ptr++,c2= *ptr,c1)&&(ptr++,c1= *ptr,c2));}while(0) | |
| 45 | static char *next_field_1 (s) char *s; { | |
| 46 | /* | |
| 47 | * Calling overhead is still present, but this routine is faster | |
| 48 | * than strlen, and doesn't bother with some of the other math | |
| 49 | * that we'd just have to undo later anyways. | |
| 50 | */ | |
| 51 | register unsigned c1 = *s, c2; | |
| 52 | while (1) { | |
| 53 | s++; c2 = *s; if (c1 == 0) break; | |
| 54 | s++; c1 = *s; if (c2 == 0) break; | |
| 55 | s++; c2 = *s; if (c1 == 0) break; | |
| 56 | s++; c1 = *s; if (c2 == 0) break; | |
| 57 | } | |
| 58 | return s; | |
| 59 | } | |
| 60 | #define next_field(ptr) ptr=next_field_1(ptr) | |
| 61 | #endif | |
| 62 | ||
| 63 | Code_t ZParseNotice(buffer, len, notice) | |
| 64 | char *buffer; | |
| 65 | int len; | |
| 66 | ZNotice_t *notice; | |
| 67 | { | |
| 68 | char *ptr, *end; | |
| 69 | unsigned long temp; | |
| 70 | int maj, numfields, i; | |
| 71 | ||
| 72 | #ifdef __LINE__ | |
| 73 | int lineno; | |
| 74 | /* Note: This definition of BAD eliminates lint and compiler | |
| 75 | * complains about the "while (0)", but require that the macro not | |
| 76 | * be used as the "then" part of an "if" statement that also has | |
| 77 | * an "else" clause. | |
| 78 | */ | |
| 79 | #define BAD_PACKET {lineno=__LINE__;goto badpkt;} | |
| 80 | /* This one gets lint/compiler complaints. */ | |
| 81 | /*#define BAD do{lineno=__LINE__;goto badpkt;}while(0)*/ | |
| 82 | #else | |
| 83 | #define BAD_PACKET goto badpkt | |
| 84 | #endif | |
| 85 | ||
| 86 | (void) memset((char *)notice, 0, sizeof(ZNotice_t)); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
87 | |
| 2086 | 88 | ptr = buffer; |
| 89 | end = buffer+len; | |
| 90 | ||
| 91 | notice->z_packet = buffer; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
92 | |
| 2086 | 93 | notice->z_version = ptr; |
| 94 | if (strncmp(ptr, ZVERSIONHDR, sizeof(ZVERSIONHDR) - 1)) | |
| 95 | return (ZERR_VERS); | |
| 96 | ptr += sizeof(ZVERSIONHDR) - 1; | |
| 97 | if (!*ptr) { | |
| 98 | #ifdef Z_DEBUG | |
| 99 | Z_debug ("ZParseNotice: null version string"); | |
| 100 | #endif | |
| 101 | return ZERR_BADPKT; | |
| 102 | } | |
| 103 | maj = atoi(ptr); | |
| 104 | if (maj != ZVERSIONMAJOR) | |
| 105 | return (ZERR_VERS); | |
| 106 | next_field (ptr); | |
| 107 | ||
| 108 | if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) | |
| 109 | BAD_PACKET; | |
| 110 | numfields = temp; | |
| 111 | next_field (ptr); | |
| 112 | ||
| 113 | /*XXX 3 */ | |
| 114 | numfields -= 2; /* numfields, version, and checksum */ | |
| 115 | if (numfields < 0) { | |
| 116 | #ifdef __LINE__ | |
| 117 | lineno = __LINE__; | |
| 118 | badpkt: | |
| 119 | #ifdef Z_DEBUG | |
| 120 | Z_debug ("ZParseNotice: bad packet from %s/%d (line %d)", | |
| 121 | inet_ntoa (notice->z_uid.zuid_addr.s_addr), | |
| 122 | notice->z_port, lineno); | |
|
35983
029ab6fae0e6
Backport more warning fixes for prpls from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
123 | #else |
|
029ab6fae0e6
Backport more warning fixes for prpls from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
124 | /* We won't use lineno anywhere else, so let's silence a warning. */ |
|
029ab6fae0e6
Backport more warning fixes for prpls from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
125 | (void)lineno; |
| 2086 | 126 | #endif |
| 127 | #else | |
| 128 | badpkt: | |
| 129 | #ifdef Z_DEBUG | |
| 130 | Z_debug ("ZParseNotice: bad packet from %s/%d", | |
| 131 | inet_ntoa (notice->z_uid.zuid_addr.s_addr), | |
| 132 | notice->z_port); | |
| 133 | #endif | |
| 134 | #endif | |
| 135 | return ZERR_BADPKT; | |
| 136 | } | |
| 137 | ||
| 138 | if (numfields) { | |
| 139 | if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) | |
| 140 | BAD_PACKET; | |
| 141 | notice->z_kind = temp; | |
| 142 | numfields--; | |
| 143 | next_field (ptr); | |
| 144 | } | |
| 145 | else | |
| 146 | BAD_PACKET; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
147 | |
| 2086 | 148 | if (numfields) { |
| 149 | if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_uid, | |
| 150 | sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) | |
| 151 | BAD_PACKET; | |
|
7475
987384816492
[gaim-migrate @ 8088]
Mark Doliner <markdoliner@pidgin.im>
parents:
2086
diff
changeset
|
152 | notice->z_time.tv_sec = ntohl((unsigned long) notice->z_uid.tv.tv_sec); |
|
987384816492
[gaim-migrate @ 8088]
Mark Doliner <markdoliner@pidgin.im>
parents:
2086
diff
changeset
|
153 | notice->z_time.tv_usec = ntohl((unsigned long) notice->z_uid.tv.tv_usec); |
| 2086 | 154 | numfields--; |
| 155 | next_field (ptr); | |
| 156 | } | |
| 157 | else | |
| 158 | BAD_PACKET; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
159 | |
| 2086 | 160 | if (numfields) { |
| 161 | if (ZReadAscii16(ptr, end-ptr, ¬ice->z_port) == ZERR_BADFIELD) | |
| 162 | BAD_PACKET; | |
| 163 | notice->z_port = htons(notice->z_port); | |
| 164 | numfields--; | |
| 165 | next_field (ptr); | |
| 166 | } | |
| 167 | else | |
| 168 | BAD_PACKET; | |
| 169 | ||
| 170 | if (numfields) { | |
| 171 | if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) | |
| 172 | BAD_PACKET; | |
| 173 | notice->z_auth = temp; | |
| 174 | numfields--; | |
| 175 | next_field (ptr); | |
| 176 | } | |
| 177 | else | |
| 178 | BAD_PACKET; | |
| 179 | notice->z_checked_auth = ZAUTH_UNSET; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
180 | |
| 2086 | 181 | if (numfields) { |
| 182 | if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) | |
| 183 | BAD_PACKET; | |
| 184 | notice->z_authent_len = temp; | |
| 185 | numfields--; | |
| 186 | next_field (ptr); | |
| 187 | } | |
| 188 | else | |
| 189 | BAD_PACKET; | |
| 190 | ||
| 191 | if (numfields) { | |
| 192 | notice->z_ascii_authent = ptr; | |
| 193 | numfields--; | |
| 194 | next_field (ptr); | |
| 195 | } | |
| 196 | else | |
| 197 | BAD_PACKET; | |
| 198 | ||
| 199 | if (numfields) { | |
| 200 | notice->z_class = ptr; | |
| 201 | numfields--; | |
| 202 | next_field (ptr); | |
| 203 | } | |
| 204 | else | |
| 205 | notice->z_class = ""; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
206 | |
| 2086 | 207 | if (numfields) { |
| 208 | notice->z_class_inst = ptr; | |
| 209 | numfields--; | |
| 210 | next_field (ptr); | |
| 211 | } | |
| 212 | else | |
| 213 | notice->z_class_inst = ""; | |
| 214 | ||
| 215 | if (numfields) { | |
| 216 | notice->z_opcode = ptr; | |
| 217 | numfields--; | |
| 218 | next_field (ptr); | |
| 219 | } | |
| 220 | else | |
| 221 | notice->z_opcode = ""; | |
| 222 | ||
| 223 | if (numfields) { | |
| 224 | notice->z_sender = ptr; | |
| 225 | numfields--; | |
| 226 | next_field (ptr); | |
| 227 | } | |
| 228 | else | |
| 229 | notice->z_sender = ""; | |
| 230 | ||
| 231 | if (numfields) { | |
| 232 | notice->z_recipient = ptr; | |
| 233 | numfields--; | |
| 234 | next_field (ptr); | |
| 235 | } | |
| 236 | else | |
| 237 | notice->z_recipient = ""; | |
| 238 | ||
| 239 | if (numfields) { | |
| 240 | notice->z_default_format = ptr; | |
| 241 | numfields--; | |
| 242 | next_field (ptr); | |
| 243 | } | |
| 244 | else | |
| 245 | notice->z_default_format = ""; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
246 | |
| 2086 | 247 | /*XXX*/ |
| 248 | if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) | |
| 249 | BAD_PACKET; | |
| 250 | notice->z_checksum = temp; | |
| 251 | numfields--; | |
| 252 | next_field (ptr); | |
| 253 | ||
| 254 | if (numfields) { | |
| 255 | notice->z_multinotice = ptr; | |
| 256 | numfields--; | |
| 257 | next_field (ptr); | |
| 258 | } | |
| 259 | else | |
| 260 | notice->z_multinotice = ""; | |
| 261 | ||
| 262 | if (numfields) { | |
| 263 | if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_multiuid, | |
| 264 | sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) | |
| 265 | BAD_PACKET; | |
|
7475
987384816492
[gaim-migrate @ 8088]
Mark Doliner <markdoliner@pidgin.im>
parents:
2086
diff
changeset
|
266 | notice->z_time.tv_sec = ntohl((unsigned long) notice->z_multiuid.tv.tv_sec); |
|
987384816492
[gaim-migrate @ 8088]
Mark Doliner <markdoliner@pidgin.im>
parents:
2086
diff
changeset
|
267 | notice->z_time.tv_usec = ntohl((unsigned long) notice->z_multiuid.tv.tv_usec); |
| 2086 | 268 | numfields--; |
| 269 | next_field (ptr); | |
| 270 | } | |
| 271 | else | |
| 272 | notice->z_multiuid = notice->z_uid; | |
| 273 | ||
| 274 | for (i=0;i<Z_MAXOTHERFIELDS && numfields;i++,numfields--) { | |
| 275 | notice->z_other_fields[i] = ptr; | |
| 276 | next_field (ptr); | |
| 277 | } | |
| 278 | notice->z_num_other_fields = i; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
279 | |
| 2086 | 280 | for (i=0;i<numfields;i++) |
| 281 | next_field (ptr); | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
282 | |
|
7475
987384816492
[gaim-migrate @ 8088]
Mark Doliner <markdoliner@pidgin.im>
parents:
2086
diff
changeset
|
283 | notice->z_message = (void *)ptr; |
| 2086 | 284 | notice->z_message_len = len-(ptr-buffer); |
| 285 | ||
| 286 | return (ZERR_NONE); | |
| 287 | } |