Re: Dont want status messages!

On Wed, Oct 16, 2002 at 11:30:44AM -0500, Tanmay Patwardhan wrote:
> When I disable notification, it bypasses the input from user, and as
> seen in HTSChunk.c - it defauts to exiting before receiving the
> entire data. (Basically it does not extend the bufferring of the
> incoming large message.)
> 
> What can I do to pass back a "y" automatically without user
> intervention to the HT_A_CONFIRM callback function? Is there any
> other workaround ? (Other than changing the code in HTSChunk.c)

That all sounds very familiar, but it's been a while since I went
through this myself...

IIRC, you *must* use HTAlert_setInteractive(YES); or things just
break. I /think/ my solution involved not calling one of those *Init()
functions directly, but instead doing most of its work manually. I
don't remember why exactly it doesn't print the messages anymore with
my code, but I can assure you it doesn't! :-)

Anyway, below is how I initialize libwww. The nonono() function avoids
that libwww prints messages like "save this data to file
/tmp/foobar?", by always answering NO. Download::alertCallback()
handles the progress messages as appropriate for the application; in
my case, it updates the GUI elements.


   // Initialize (g)libwww
   void Download::init() {
     HTAlertInit();
   # if DEBUG_DOWNLOAD
     HTSetTraceMessageMask("flbtspuhox");
     HTTrace_setCallback(tracer);
   # endif
   
     HTEventInit(); // Necessary on Windows to initialize WinSock
     HTNet_setMaxSocket (32);
   
     /* These calls are necessary for redirections to work. (Why? Don't
        ask why - this is libwww, after all...) */
     HTList* converters = HTList_new();
     HTConverterInit(converters); // Register the default set of converters
     HTFormat_setConversion(converters); // Global converters for all requests
   
     HTAlert_setInteractive(YES);
     // HTPrint_setCallback(printer);
     glibwww_init("jigdo", JIGDO_VERSION);
   
     HTAlert_add(Download::alertCallback, HT_A_PROGRESS); // Progress reports
     HTAlert_add(nonono, static_cast<HTAlertOpcode>(
                 HT_A_CONFIRM | HT_A_PROMPT | HT_A_SECRET | HT_A_USER_PW));
     // To get notified of errors, redirects etc.
     HTNet_addAfter(Download::afterFilter, NULL /*template*/, 0 /*param*/,
                    HT_ALL, HT_FILTER_MIDDLE);
   }

   BOOL nonono(HTRequest*, HTAlertOpcode, int, const char*, void*,
               HTAlertPar*) {
     return NO;
   }

In case this doesn't yet make a difference, additionally check whether
glibwww_init() does (it makes an immense number of calls to
libwww...). It's a bit large, so I'm not attaching it - see
glibwww-init.cc in the jigdo tarball on
<http://atterer.net/jigdo/#source>. glibwww should also be available
somewhere on gnome.org.

HTH,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer     |  CS student at the Technische  |  GnuPG key:
  | \/¯|  http://atterer.net  |  Universität München, Germany  |  0x888354F7
  ¯ '` ¯

Received on Wednesday, 16 October 2002 16:29:46 UTC