new client plans and libpurple

Zoltán Sólyom z-ismeretlen at freemail.hu
Fri Mar 29 12:39:11 EDT 2013


> Inspired by Pidgin's own generate_gtk_zip.sh script in 
> pidgin/win32/nsis, I realized that much of the BuildingWinPidgin 
> instructions could be automated into a script using wget to download 
> and tar/unzip to extract the files automatically.
> [...]
> It could probably be extended to handle most of Zoltán's instructions 
> too, though Visual Studio developers may not want to install MinGW 
> just to run this script.
Some of the instructions on BuildingWinPidgin for what to download could 
be automated for a Visual Studio project, though I had to get an Apple 
Id just to get the Bonjour package. Getting the zip and tar.gz files and 
extracting them took almost no time compared to all the pain finding out 
what to do after that. Doing what needs to be done is still not 
difficult if someone is not willing to install MinGW for an automated 
script.

I haven't tried compiling Pidgin, only libpurple, so that's all I can 
help with. In the current state, all the needed DLLs are created, but no 
symbols have been exported yet. This is not entirely true, because a lot 
of symbols had to be exported from libpurple.dll (and some other DLLs) 
for the protocols to compile. (There is no "export all symbols" setting 
in VS as far as I know.) Exporting is simple, I'll just create .def 
files and list what's needed. Once I'm done and rearranged the directory 
structure of the DLL projects a little (it's a mess right now because I 
didn't expect so many) I will share the VS project.

In the attached text you will find the complete list of my changes to 
the libpurple source code.

The next step will be to create a C# project and make a very simple 
program that lets me sign in to my xmpp account. If it succeeds I'll 
probably ask for help to try out all the other protocols because that's 
a lot of registrations.

-------------- next part --------------
// I list here which parts of the code had to be changed in libpurple
// to compile with Visual Studio Express 2012.
// I won't provide line numbers because I haven't looked into the
// latest source, and finding the problems is easy anyway. The
// ifdef/ifndef _MSC_VER was added by me, together with the code in
// the ifdef block, or the else block of ifndef.

libpurple/plugin.c:
// Just look for !RUNNING_ON_VALGRIND. It always evaluates
// to true when not using Valgrind.
#ifndef _MSC_VER
        if (!g_getenv("PURPLE_LEAKCHECK_HELP") && !RUNNING_ON_VALGRIND)
#else
        if (!g_getenv("PURPLE_LEAKCHECK_HELP"))
#endif

// This is added after all the includes. (I'm not familiar with the C syntax,
// just guessed this is what the replacement should be in VS)
// Replace the gg_debug_dcc define with:
#ifndef _MSC_VER
#define gg_debug_dcc(dcc, level, fmt...) \
    gg_debug_session(((dcc) != NULL) ? (dcc)->sess : NULL, level, fmt)
#else
#define gg_debug_dcc(dcc, level, ...) \
    gg_debug_session(((dcc) != NULL) ? (dcc)->sess : NULL, level, __VA_ARGS__)
#endif

//-----------------------------------------------

libpurple/protocols/gg/lib/libgadu.h:
// Add at the top right after #define __GG_LIBGADU_H
#ifdef _MSC_VER
#include "config.h"
#include "internal.h"
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif

// VS complained that empty structs and unions are not valid C.
// I haven't found references to this struct in the whole source.
// If it is added as some kind of packing this can potentially break
// things, though GG_PACKED when not compiled under gcc is an empty define.
#ifndef _MSC_VER
struct gg_dcc7_dunno1 {
    // XXX
} GG_PACKED;
#endif

//-----------------------------------------------

libpurple/protocols/bonjour/mdns_common.h:
// Add at the top:
#ifdef _MSC_VER
#include "config.h"
#endif

//-----------------------------------------------

libpurple/protocols/irc/irc.h:
// Add to the top:
#ifdef _MSC_VER
#include "config.h"
#endif

//-----------------------------------------------

libpurple/plugins/ssl/ssl-nss.c:
// Add after the includes. I copied this out from a different source
// file in libpurple, so hopefully this is what it should be.
#ifdef _MSC_VER
#ifndef _SSIZE_T_DEFINED
#ifdef  _WIN64
typedef __int64    ssize_t;
#else
typedef _W64 int   ssize_t;
#endif
#define _SSIZE_T_DEFINED
#endif
#endif

//-----------------------------------------------

libpurple/protocols/mxit/protocol.c:
// Add after the includes.
#ifdef _MSC_VER
#include "cipher.h"
#define strtoll _strtoi64;
#endif

// In the function dump_bytes, replace the char msg declaration to:
#ifndef _MSC_VER
    char        msg[( len * 3 ) + 1];
#else
    char *msg = (char*)malloc(sizeof(char) * ((len * 3)  + 1));
#endif

// Add to the end of the same function:
#ifdef _MSC_VER
    free(msg);
#endif

// Same in mxit_write_http_post function:
#ifndef _MSC_VER
    char        request[256 + packet->datalen];
#else
    char *request = (char*)malloc(sizeof(char) * (256 + packet->datalen));
#endif

// Add to the end of the same function:
#ifdef _MSC_VER
    free(request);
#endif

// Look for the mxit_send_packet function. I added the next code on
// the 16th line after the /* socket connection */  comment.
// Replace the declaration of char data with:
#ifndef _MSC_VER
        char        data[packet->datalen + packet->headerlen];
#else
        char *data = (char*)malloc(sizeof(char) * (packet->datalen + packet->headerlen));
#endif

// Add to the end of the if block:
#ifdef _MSC_VER
        free(data);
#endif

//-----------------------------------------------
//-----------------------------------------------

// The following files had includes not in the SDK on Windows. Most can
// be ifndef-ed. If something is still missing, add #include <io.h> in
// an else block. (io.h had to be added to files marked with *)

unistd.h not found in:
libpurple/protocols/gg/lib/
    dcc7.c
    *sha1.c
    resolver.c
    pubdir.c
    libgadu.c
    handlers.c
    events.c
    dcc.c
    common.c
    dcc7.c (already mentioned above)
    http.c

libpurple/protocols/novell/
    *nmconn.c:

//-----------------------------------------------

inttypes.h not found in:
libpurple/protocols/gg/
    lib.message.h

//-----------------------------------------------

utsname.h not found in:
libpurple/protocols/jabber/
    iq.c


More information about the Devel mailing list