… | |
… | |
33 | */ |
33 | */ |
34 | |
34 | |
35 | #include <global.h> |
35 | #include <global.h> |
36 | #include <sproto.h> |
36 | #include <sproto.h> |
37 | |
37 | |
38 | #include <newclient.h> |
|
|
39 | #include <newserver.h> |
|
|
40 | #include <loader.h> |
|
|
41 | |
|
|
42 | #define MAX_FACE_SETS 20 /**< Maximum number of image sets the program will handle */ |
38 | #define MAX_FACE_SETS 20 /**< Maximum number of image sets the program will handle */ |
43 | |
39 | |
44 | /** Information about one image */ |
40 | /** Information about one image */ |
45 | typedef struct FaceInfo |
41 | typedef struct FaceInfo |
46 | { |
42 | { |
47 | |
43 | |
48 | uint8 *data; /**< image data */ |
44 | uint8 *data; /**< image data */ |
49 | |
|
|
50 | uint16 datalen; /**< length of the xpm data */ |
45 | uint16 datalen; /**< length of the xpm data */ |
51 | |
|
|
52 | uint32 checksum; /**< Checksum of face data */ |
46 | uint32 checksum; /**< Checksum of face data */ |
53 | } FaceInfo; |
47 | } FaceInfo; |
54 | |
48 | |
55 | /** Information about one face set */ |
49 | /** Information about one face set */ |
56 | typedef struct |
50 | typedef struct |
… | |
… | |
312 | * the caching attribute. |
306 | * the caching attribute. |
313 | * |
307 | * |
314 | */ |
308 | */ |
315 | |
309 | |
316 | void |
310 | void |
317 | SetFaceMode (char *buf, int len, client_socket *ns) |
311 | SetFaceMode (char *buf, int len, client *ns) |
318 | { |
312 | { |
319 | int mask = (atoi (buf) & CF_FACE_CACHE), mode = (atoi (buf) & ~CF_FACE_CACHE); |
313 | int mask = (atoi (buf) & CF_FACE_CACHE), mode = (atoi (buf) & ~CF_FACE_CACHE); |
320 | |
314 | |
321 | if (mode == CF_FACE_NONE) |
315 | if (mode == CF_FACE_NONE) |
322 | ns->facecache = 1; |
316 | ns->facecache = 1; |
323 | else if (mode != CF_FACE_PNG) |
317 | else if (mode != CF_FACE_PNG) |
324 | { |
|
|
325 | packet sl; |
|
|
326 | sl.printf ("drawinfo %d %s", NDI_RED, "Warning - send unsupported face mode. Will use Png"); |
318 | ns->send_packet_printf ("drawinfo %d %s", NDI_RED, "Warning - send unsupported face mode. Will use Png"); |
327 | ns->send_packet (sl); |
|
|
328 | } |
|
|
329 | |
319 | |
330 | if (mask) |
320 | if (mask) |
331 | ns->facecache = 1; |
321 | ns->facecache = 1; |
332 | } |
322 | } |
333 | |
323 | |
… | |
… | |
336 | * This will be called often if the client is |
326 | * This will be called often if the client is |
337 | * caching images. |
327 | * caching images. |
338 | */ |
328 | */ |
339 | |
329 | |
340 | void |
330 | void |
341 | SendFaceCmd (char *buff, int len, client_socket * ns) |
331 | SendFaceCmd (char *buff, int len, client * ns) |
342 | { |
332 | { |
343 | long tmpnum = atoi (buff); |
333 | long tmpnum = atoi (buff); |
344 | short facenum = tmpnum & 0xffff; |
334 | short facenum = tmpnum & 0xffff; |
345 | |
335 | |
346 | if (facenum != 0) |
336 | if (facenum != 0) |
… | |
… | |
355 | * face (and askface is the only place that should be setting it). Otherwise, |
345 | * face (and askface is the only place that should be setting it). Otherwise, |
356 | * we look at the facecache, and if set, send the image name. |
346 | * we look at the facecache, and if set, send the image name. |
357 | */ |
347 | */ |
358 | |
348 | |
359 | void |
349 | void |
360 | esrv_send_face (client_socket *ns, short face_num, int nocache) |
350 | esrv_send_face (client *ns, short face_num, int nocache) |
361 | { |
351 | { |
362 | char fallback; |
352 | char fallback; |
363 | |
353 | |
364 | if (face_num <= 0 || face_num >= nrofpixmaps) |
354 | if (face_num <= 0 || face_num >= nrofpixmaps) |
365 | { |
355 | { |
… | |
… | |
411 | * and the image_info file information. See the doc/Developers/protocol |
401 | * and the image_info file information. See the doc/Developers/protocol |
412 | * if you want further detail. |
402 | * if you want further detail. |
413 | */ |
403 | */ |
414 | |
404 | |
415 | void |
405 | void |
416 | send_image_info (client_socket * ns, char *params) |
406 | send_image_info (client * ns, char *params) |
417 | { |
407 | { |
418 | packet sl; |
408 | packet sl; |
419 | |
409 | |
420 | sl.printf ("replyinfo image_info\n%d\n%d\n", nrofpixmaps - 1, bmaps_checksum); |
410 | sl.printf ("replyinfo image_info\n%d\n%d\n", nrofpixmaps - 1, bmaps_checksum); |
421 | |
411 | |
… | |
… | |
436 | * For each image in [start..stop] sends |
426 | * For each image in [start..stop] sends |
437 | * - checksum |
427 | * - checksum |
438 | * - name |
428 | * - name |
439 | */ |
429 | */ |
440 | void |
430 | void |
441 | send_image_sums (client_socket * ns, char *params) |
431 | send_image_sums (client * ns, char *params) |
442 | { |
432 | { |
443 | int start, stop; |
433 | int start, stop; |
444 | char *cp, buf[MAX_BUF]; |
434 | char *cp, buf[MAX_BUF]; |
445 | |
435 | |
446 | packet sl; |
436 | packet sl; |