Opened 12 years ago

Closed 11 years ago

#2337 closed defect (fixed)

serv_got_im passes NULL as 'who' parameter to purple_conv_im_write

Reported by: resiak Owned by:
Milestone: 2.4.2 Component: libpurple
Version: 2.0.2 Keywords:
Cc:

Description

Is there any particular reason why it does this rather than passing the who parameter that it just passed to the receiving-im-msg signal?

Change History (5)

comment:1 Changed 12 years ago by nowic

Component: libpurple

Version: 2.1.1

I think my problem is related to this bug. I'm writing a plugin and would like to use the 'who' parameter of the signal "writing-im-msg", but it is always NULL. Not very usefull. I'm new to libpurple, so maybe I'm just missing something...

My test plugin:

#include <glib.h>

#define PURPLE_PLUGINS
#include "notify.h"
#include "plugin.h"
#include "version.h"
#include "signals.h"
#include "debug.h"
#include "core.h"

#define TEST_ID "core-test"

/* --- signal handler for "writing-im-msg" --- */
static gboolean writing_im_msg(PurpleAccount *account, const char *who, char **message, 
		PurpleConversation *conv, PurpleMessageFlags flags) {

	purple_debug(PURPLE_DEBUG_INFO, TEST_ID, "Account (ptr): %i\n", (int) account);
	// It's always NULL. A bug?
	purple_debug(PURPLE_DEBUG_INFO, TEST_ID, "Who: %s\n", who);
	
	purple_debug(PURPLE_DEBUG_INFO, TEST_ID, "Message: %s\n", *message);
	purple_debug(PURPLE_DEBUG_INFO, TEST_ID, "Conversation (ptr): %i\n", (int) conv);

	return FALSE;
}

/* --- gets called when loading the plugin --- */
static gboolean plugin_load(PurplePlugin *plugin) {

	purple_debug(PURPLE_DEBUG_INFO, TEST_ID,
		"Compiled with Purple '%d.%d.%d', running with Purple '%s'.\n",
		PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, PURPLE_MICRO_VERSION, purple_core_get_version());

	void *conv_handle;
	conv_handle = purple_conversations_get_handle();

	purple_signal_connect(conv_handle, "writing-im-msg", plugin,
		PURPLE_CALLBACK(writing_im_msg), NULL);


	purple_debug(PURPLE_DEBUG_INFO, TEST_ID, "Done loading.\n");
	
	return TRUE;
}

/* --- gets called when libpurple probes the plugin --- */
static void init_plugin(PurplePlugin *plugin) {
	
	return;
}

static PurplePluginInfo info = {
    PURPLE_PLUGIN_MAGIC,    
    PURPLE_MAJOR_VERSION,   
    PURPLE_MINOR_VERSION,   
    PURPLE_PLUGIN_STANDARD, 
    NULL,                   
    0,                      
    NULL,                 
    PURPLE_PRIORITY_DEFAULT,
    TEST_ID, 
    "Test Plugin",
    "0.0.1",
    "Test Plugin",   
    "Test Plugin. Bla bla... ",   
    "Nowic",
    "www.test.ch",
    plugin_load,
    NULL,                   
    NULL,
    NULL,                   
    NULL,                   
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL
};

PURPLE_INIT_PLUGIN(test, init_plugin, info)

comment:2 Changed 12 years ago by rlaager

nowic: Your problem has been fixed in 2.2.0, right?

comment:3 Changed 12 years ago by rlaager

Plugins can change the who parameter in receiving-im-msg, so we'd want to use name, not who, but I don't see any reason not to pass that.

comment:4 Changed 12 years ago by nowic

Yes, it works now. Thanks a lot!

http://developer.pidgin.im/doxygen/dev/html/conversation-signals.html#writing-im-msg

"who: The name of the user."

comment:5 Changed 11 years ago by resiak@…

  • Milestone set to 2.4.2
  • Resolution set to fixed
  • Status changed from new to closed

(In 77fe840adf32ea75b35d2667354809b813ccde45) Pass something useful as the 'who' parameter to purple_conv_im_write for incoming messages, not NULL. I don't really see what this could break, but disapprove it if I'm blind. Fixes #2337

Note: See TracTickets for help on using tickets.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!