[Pidgin] #2337: serv_got_im passes NULL as 'who' parameter to purple_conv_im_write

Pidgin trac at pidgin.im
Wed Aug 29 13:26:49 EDT 2007


#2337: serv_got_im passes NULL as 'who' parameter to purple_conv_im_write
------------------------+---------------------------------------------------
  Reporter:  resiak     |       Owner:       
      Type:  defect     |      Status:  new  
  Priority:  minor      |   Milestone:       
 Component:  libpurple  |     Version:  2.0.2
Resolution:             |    Keywords:       
   Pending:  0          |  
------------------------+---------------------------------------------------
Comment (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)
 }}}

-- 
Ticket URL: <http://developer.pidgin.im/ticket/2337#comment:1>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list