Problems with imgstore
Qjuh
qjuh at users.sourceforge.net
Sun May 13 17:22:14 EDT 2007
Hello,
I am developing an LaTeX-Plugin for Pidgin which was once called
gaim-latex (we changed the name to pidgin-latex now).
Our code worked perfectly with Gaim 2.0.0beta6 but when run under
Pidgin 2.0.0 our created Image (after processing it with LaTeX etc.)
is sent to the imgstore via purple_imgstore_add_by_id. If we ask for
the filedata, we get it from the imgstore, so there's no problem from
our site. But when we include the id in the message via <img
id=\"%d\"> the image doesn't show, but a red cross instead.
Maybe someone could tell me if that's a misuse because of API changes
again, or what else is going wrong.
btw: The Debug-Window even states: imgstore: retrieved image id 1
This is the important part of the code (before we create the image,
and afterwards we just send the message):
name = "pidginTeX.png";
idimg = purple_imgstore_add_with_id(filedata, MAX(1024,size), name);
g_free(filedata);
filedata = NULL;
if (idimg == 0)
{
buf = g_strdup_printf("Failed to store image.");
purple_notify_error(NULL,"LaTeX", buf, NULL);
g_free(buf);
return FALSE;
}
idstring = malloc(10);
sprintf(idstring, "%d", idimg);
// making new message
if ((message = malloc (strlen(*tmp2) - pos2 + pos1 +
strlen(idstring) + strlen(IMG_BEGIN) + strlen(IMG_END) + 1)) == NULL)
{
purple_notify_error(NULL,"LaTeX", "couldn't make the message.", NULL);
return FALSE;
}
if (pos1 > 0)
{
strncpy(message, *tmp2, pos1);
message[pos1] = '\0';
strcat(message, IMG_BEGIN);
} else {
strcpy(message, IMG_BEGIN);
}
strcat(message, idstring);
strcat(message, IMG_END);
More information about the Devel
mailing list