Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
MERVBot doesn't handle *getfile?

 
Post new topic   Reply to topic Printable version
 View previous topic  Merv-Bot cant !say (8) Post :: Post need help with spawns.txt  View next topic  
Author Message
Samapico
No, these DO NOT look like penises, ok?


Age:31
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Sep 06, 2010 7:42 pm    Post subject: MERVBot doesn't handle *getfile? Reply to topic Reply with quote

I'm trying to get a mervbot to *getfile a list of files from the server, in sequence. But when the bot does a *getfile, it
What shows up in the bot's log:

BOT>Sama PV:Samapico> !getfilelist somelist.txt
BOT>Sama A:File sent: server.cfg
(please wait...)
BOT>Sama Unknown message type 16(17)


From what I understand, a packet 16 with a length of 17 would be a file transfer packet with no data


What's happening?


Relevant code from the core:
Code: Show/Hide


void __stdcall handleFileTransfer(hostMessage *m)
{   DEFLATE_CLASS

   /*   Field   Length   Description
      0      1      Type byte
      1      16      File name
      17      ...      [Compressed] file
   */

   char *name = msg + 1;
   char *buffer = msg + 17;
   Uint32 i, length = len - 17;

   if (len <= 17)
   {
      handleUnknown(m);

      return;
   }

   for (i = 0; i < 16; ++i)
   {
      char c = name[i];

      if (c == 0)
         break;

      switch (c)
      {
      case '/':
      case '\\':
         h->logEvent("WARNING: Invalid downloaded-file name path ignored. (%s)", name);
         return;
      };

      if ((c < ' ') || (c > '~'))
      {
         h->logEvent("WARNING: Invalid downloaded-file name chars ignored.");
         return;
      }
   }

   if (i == 16)
   {
      h->logEvent("WARNING: Unterminated downloaded-file name ignored.");

      return;
   }

   if (*name)
   {   // regular file
      String fname = "get/";
      fname += name;

      ofstream file(fname.msg, ios::binary);
      if (file)
      {
         file.write(buffer, length);

         h->logEvent("Received file: %s", fname.msg);

         h->imports->talk(makeFile(fname.msg));
      }
      else
      {
         h->logEvent("Unable to open file for write: %s", fname.msg);
      }
   }
   else
   {   // news file
      h->downloadingNews = false;

      if (decompress_to_file("get/news.txt", buffer, length))
         h->logEvent("News file successfully transferred!");
      else
         h->logEvent("Unable to decompress news file.");
   }
}

_________________
DCME co-developer
17th Parallel Head Sysop
Subspace: The Future
Back to top
View users profile Send private message Add User to Ignore List
cycad
Novice


Gender:Gender:Male
Joined: Feb 12 2004
Posts: 29
Offline

PostPosted: Tue Sep 07, 2010 2:32 pm    Post subject: Reply to topic Reply with quote

I think file transfer packets are core type 0x0A. I don't know what type 16 would be, I do S2C file transfers using 0x0A exclusively (which may or may not be correct:). If you can print the raw packet data received the problem might be more evident.

Also, is this with subgame or asss?
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Age:31
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Tue Sep 07, 2010 9:52 pm    Post subject: Reply to topic Reply with quote

subgame

Any easy way to print the raw packet data? Or do I need to recompile the bot entirely?


And... according to the wiki, it's 0x10

http://wiki.minegoboom.com/index.php/UDP_Game_Protocol


----------------------------------------
0x0A Game 0x40306F Password response

[...]

----------------------------------------
0x10 Game 0x4027CD File transfer

- 0 1 Type
Back to top
View users profile Send private message Add User to Ignore List
cycad
Novice


Gender:Gender:Male
Joined: Feb 12 2004
Posts: 29
Offline

PostPosted: Tue Sep 07, 2010 11:54 pm    Post subject: Reply to topic Reply with quote

I'm not sure about packet printing, maybe merv has a debug output option somewhere.

As far as the packet types mine is for the core type (not game) 0x0A, and my handler is http://pastebin.com/nZBxj1ub
and I haven't had any problems/complaints. Maybe there's a difference between lvz file transfers such as when you join an arena and *getfile transfers. The handler above is for *getfile.

It's been a while since I looked at the code so I might be missing something.
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 101 page(s) served in previous 5 minutes.

phpBB Created this page in 0.076907 seconds : 29 queries executed (50.8%): GZIP compression disabled