mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mldonkey-users] Firebird + MLdonkey-Plugin


From: Olivier FAURAX
Subject: Re: [Mldonkey-users] Firebird + MLdonkey-Plugin
Date: Thu, 10 Jul 2003 09:09:16 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.1) Gecko/20020826

http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=The%20web%20interface

Hielke Christian Braun wrote:
Hello Dirk,

dumb question. How do i set it up in Mozilla? When i click a ed2k://
link i only get 'ed2k is not a registered protocol'. Setting up a
mimetype handler for ed2k does also not work.

If it is important, i have Mozilla 1.4b on Debian.

Best regards,
 Christian.

On Tue, Jul 08, 2003 at 12:18:10PM +0200, Dirk wrote:

Thoran wrote:


MrOrange> Hello, is there a way to get the Mozilla-Plugin working with
MrOrange> Mozilla's Firebird-Browser (the standalone version).  With
MrOrange> Firebird I only get a pop-up window displaying some adverts
MrOrange> (don't know where this URL comes from).

I installed it under Firebird and it works perfectly.  I didn't do
anything special.  Here is my version:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516
Mozilla Firebird/0.6

Cheers,

Thoran



if someone still has problems with those plugins he might consider
giving the attached C program a try... it's my port of the
mldonkey_submit script but supports local torrent files (with
wildcards!), links to torrent files and ed2k_links of course... it works
from commandline or as "open with..." extension in mozilla..

should compile with windows too...

Dirk



/*
 mldonkey_submit in C
 by Dirk (address@hidden)
Supports
 - Bittorrent links
 - Bittorrent files
 - ed2k links
 Works with mozilla
Compile with: gcc mldonkey_submit.c -o mldonkey_submit -s
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#if defined(_WIN32)
#include <windows.h>
#include <winsock2.h>
#define FILE_SEPARATOR ('\\')
#else
#include <unistd.h>
#include <sys/file.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netdb.h>
#define FILE_SEPARATOR ('/')
#endif

#define HOST_S ("127.0.0.1")
#define PORT (4080)
#define USER_S ("admin")
#define PASS_S ("")


#if defined(_WIN32)
#define READ(a,b,c)  recv((a),(b),(c),0)
#define WRITE(a,b,c) send((a),(b),(c),0)
#else
#define READ(a,b,c)  read((a),(b),(c))
#define WRITE(a,b,c) write((a),(b),(c))
#endif
#ifndef MAXBUFSIZE
#define MAXBUFSIZE (32768)
#endif


static int
tcp_open (void)
{
 struct sockaddr_in stAddr;
 struct hostent *host;
 int sock;
 struct linger l;

 memset (&stAddr, 0, sizeof (stAddr));
 stAddr.sin_family = AF_INET;
 stAddr.sin_port = htons (PORT);

 if ((host = gethostbyname (HOST_S)) == NULL)
   return 0;

 stAddr.sin_addr = *((struct in_addr *) host->h_addr_list[0]);

 if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
   return 0;

 l.l_onoff = 1;
 l.l_linger = 5;
 if (setsockopt (sock, SOL_SOCKET, SO_LINGER, (char *) &l, sizeof (l)) < 0)
   return 0;

 if (connect (sock, (struct sockaddr *) &stAddr, sizeof (stAddr)) < 0)
   return 0;

 return sock;
}


char *
stresc (char *dest, const char *src)
{
 unsigned char c;
 char *p = dest;
 const unsigned char *positiv =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"
   "0123456789"
#if 1
   "+/."
#else
   "-_.!~"                     // mark characters
   "*\\()%"                    // do not touch escape character
   ";/?:@"                     // reserved characters
   "&=+$,"                     // see RFC 2396
//  "\x7f ... \xff"    far east languages(Chinese, Korean, Japanese)
#endif
   ;

 while ((c = *src++))
   if (strchr (positiv, c) != NULL || c >= 0x7f)
     *p++ = c;
   else
     {
       sprintf (p, "%%%02X", c);
       p += 3;
     }
 *p = 0;

 return dest;
}


int
main (int argc, char **argv)
{
 int x = 0;

 if (argc < 2)
   {
     fprintf (stderr, "Usage: mldonkey_submit <ed2kURI|torrent> ...\n");
     exit (1);
   }

 for (x = 1; x < argc; x++)
   {
     int socket = 0;
     char buf[MAXBUFSIZE], buf2[MAXBUFSIZE];
if (!(socket = tcp_open()))
       {
         fprintf (stderr, "ERROR: could not open tcp connection\n");
         exit (1);
       }
stresc (buf, argv[x]);

     if (!strchr (buf, FILE_SEPARATOR))
       {
         getcwd (buf2, MAXBUFSIZE);
         sprintf (buf2 + strlen (buf2), "%c%s", FILE_SEPARATOR, buf);
         strcpy (buf, buf2);
       }

     sprintf (buf2, "GET /submit?q=dllink+\"%s\" HTTP/1.1\r\n"
       "Host: %s:%d\r\n"
       "User-Agent: mldonkey_submit\r\n"
       "Accept: */*\r\n"
//        "Keep-Alive: 300\r\n"
//        "Connection: keep-alive\r\n"
       "Referer: http://%s:%d/submit?\r\n";
       "\r\n",
       buf,
       HOST_S,
       PORT,
       HOST_S,
       PORT);

//#ifdef  DEBUG
     fprintf (stderr, "%s\n", buf);
     fflush (stderr);
//#endif

     WRITE (socket, buf2, strlen (buf2));
     READ (socket, buf2, MAXBUFSIZE);
//#ifdef DEBUG
     fprintf  (stderr, "%s\n\n", buf2);
     fflush (stderr);
//#endif  DEBUG

     close (socket);
   }

 return 0;
}


_______________________________________________
Mldonkey-users mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/mldonkey-users




_______________________________________________
Mldonkey-users mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/mldonkey-users


--
"Caminante no hay camino, se hace camino al andar"
Olivier Faurax, Elève ESIL Dpt Informatique (Promo 2004)
http://www.esil.univ-mrs.fr/~ofaurax





reply via email to

[Prev in Thread] Current Thread [Next in Thread]