Menu

serv_send_im doesn't use event_im_send event?

2000-07-20
2000-07-20
  • Joe Carpenter

    Joe Carpenter - 2000-07-20

    I'm writing a plugin that gets an event_im_recv message, it parses the text, generates a reply, and sends out that reply. I would like the generated reply to show up in the open conversation window for that particular user.

    However, when I use serv_send_im, it doesn't then throw an event_im_send event, it just sends it out. Thus, the method that handles event_im_send never gets called, and the text of what I sent doesn't get displayed.

    If I put a call to write_to_conv in the receive_im function, the reply shows up in the conversation, but before the line that it is in response to.

    Is there some way that I'm missing to deal with this in a more elegant manner? Should serv_send_im be throwing an event_im_send event? Am I making any sense?

     
    • Eric Warmenhoven

      > However, when I use serv_send_im, it doesn't then throw an
      > event_im_send event, it just sends it out. Thus, the method that handles
      > event_im_send never gets called, and the text of what I sent doesn't get
      > displayed.

      There are lots of times when you want to send things without triggering an event_im_send event; for example, the lagometer. So the behavior, IMNSHO, is correct. event_im_send only gets triggered when the user sends a message in an IM window, and not when gaim causes a message to be sent.

      > If I put a call to write_to_conv in the receive_im function, the reply shows
      > up in the conversation, but before the line that it is in response to.

      Right. Plugins get called before the message gets written, in case they want to change what's said :).

      > Is there some way that I'm missing to deal with this in a more elegant
      > manner?

      If you display the message yourself using write_to_conv, then display the response similarly, then set the char **text to point to NULL, gaim shouldn't display it. (This is why you need to check that the arguments do not point to NULL - plugins are legally allowed to make them).

      > Should serv_send_im be throwing an event_im_send event?

      Once again, IMNSHO, no.

      > Am I making any sense?

      Perfect sense. :) I hope I made sense, and that what I said helps.

       
      • Joe Carpenter

        Joe Carpenter - 2000-07-20

        >There are lots of times when you want to send things
        >without triggering an event_im_send event; for example, the >lagometer. So the behavior, IMNSHO, is correct.

        I realized that would be bad about two seconds after clicking post (actually, it would screw up some other things I'm doing), but it's been a long day and there's too much blood in my caffene system.

        >If you display the message yourself using write_to_conv,
        >then display the response similarly, then set the char **
        >text to point to NULL, gaim shouldn't display it. (This is
        >why you need to check that the arguments do not point to
        >NULL - plugins are legally allowed to make them).

        Ah. I did not think of that, I'll try that. That's kind of scary, I wasn't checking for nulls. I am now though.

        -Joe

         
        • Rob Flynn

          Rob Flynn - 2000-07-20

          *giggles at the Blood in the Caffeine system comment*