comparison src/rvous.c @ 205:5531861bf3f5

[gaim-migrate @ 215] Mostly done, just figure out the checksum :P committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 01 May 2000 00:43:23 +0000
parents 579e59e66381
children ec0686b3b03f
comparison
equal deleted inserted replaced
204:579e59e66381 205:5531861bf3f5
376 /* 1. build/send header */ 376 /* 1. build/send header */
377 c = file + strlen(file); 377 c = file + strlen(file);
378 while (*(c - 1) != '/') c--; 378 while (*(c - 1) != '/') c--;
379 buf = frombase64(ft->cookie); 379 buf = frombase64(ft->cookie);
380 sprintf(debug_buff, "Building header to send %s (cookie: %s)\n", file, buf); 380 sprintf(debug_buff, "Building header to send %s (cookie: %s)\n", file, buf);
381 printf("%s", buf); fflush(stdout);
382 debug_print(debug_buff); 381 debug_print(debug_buff);
383 fhdr->hdrtype = 0x1108; 382 fhdr->hdrtype = 0x1108;
384 snprintf(fhdr->bcookie, 8, "%s", buf); 383 snprintf(fhdr->bcookie, 8, "%s", buf);
385 g_free(buf); 384 g_free(buf);
386 fhdr->encrypt = 0; 385 fhdr->encrypt = 0;
387 fhdr->compress = 0; 386 fhdr->compress = 0;
388 fhdr->totfiles = 1; 387 fhdr->totfiles = 1;
389 fhdr->filesleft = 1; 388 fhdr->filesleft = 1;
390 fhdr->totparts = 1; 389 fhdr->totparts = 1;
391 fhdr->partsleft = 1; 390 fhdr->partsleft = 1;
392 fhdr->totsize = (long)st.st_size; /* ? */ 391 fhdr->totsize = (long)st.st_size; /* total size of all available files */
393 /* size = 10 (date) + 1 + 5 (time) + 1 + 8 (size) + 1 + name + 2 = 30 + name */ 392 /* size = 10 (date) + 1 + 5 (time) + 1 + 8 (size) + 1 + name + 2 = 30 + name */
394 fhdr->size = 30 + strlen(c); /* size of listing.txt */ 393 fhdr->size = 30 + strlen(c); /* size of listing.txt */
395 fhdr->modtime = time(NULL); /* time since UNIX epoch */ 394 fhdr->modtime = time(NULL); /* time since UNIX epoch */
396 fhdr->checksum = 0x89f70000; /* ? */ 395 fhdr->checksum = 0x10110000; /* ? */
397 fhdr->rfrcsum = 0; 396 fhdr->rfrcsum = 0;
398 fhdr->rfsize = 0; 397 fhdr->rfsize = 0;
399 fhdr->cretime = 0; 398 fhdr->cretime = 0;
400 fhdr->rfcsum = 0; 399 fhdr->rfcsum = 0;
401 fhdr->nrecvd = 0; 400 fhdr->nrecvd = 0;
402 fhdr->recvcsum = 0; 401 fhdr->recvcsum = 0;
403 snprintf(fhdr->idstring, 32, "Gaim"); 402 snprintf(fhdr->idstring, 32, "Gaim");
404 fhdr->flags = 0x20; /* don't ask me why */ 403 fhdr->flags = 0x02; /* don't ask me why */
405 fhdr->lnameoffset = 0x1A; /* ? still no clue */ 404 fhdr->lnameoffset = 0x1A; /* ? still no clue */
406 fhdr->lsizeoffset = 0x10; /* whatever */ 405 fhdr->lsizeoffset = 0x10; /* whatever */
407 fhdr->dummy[0] = 0; 406 memset(fhdr->dummy, 0, 69);
408 fhdr->macfileinfo[0] = 0; 407 memset(fhdr->macfileinfo, 0, 16);
409 fhdr->nencode = 0; 408 fhdr->nencode = 0;
410 fhdr->nlanguage = 0; 409 fhdr->nlanguage = 0;
411 snprintf(fhdr->name, 64, "listing.txt"); 410 snprintf(fhdr->name, 64, "listing.txt");
412 snprintf(bmagic, 7, "OFT2\001\000"); 411 snprintf(bmagic, 6, "TFT1\001");
413 read_rv = write(ft->fd, bmagic, 6); 412 read_rv = write(ft->fd, bmagic, 6);
414 if (read_rv <= -1) { 413 if (read_rv <= -1) {
415 sprintf(debug_buff, "Couldn't write opening header \n"); 414 sprintf(debug_buff, "Couldn't write opening header \n");
416 debug_print(debug_buff); 415 debug_print(debug_buff);
417 close(ft->fd); 416 close(ft->fd);