#10507: add hook to pidgin_notify_formatted()

View: New views
11 Messages — Rating Filter:   Alert me  

#10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
------------------+---------------------------------------------------------
Reporter:  jts    |        Type:  enhancement
  Status:  new    |   Component:  pidgin (gtk)
 Version:  2.6.2  |    Keywords:              
------------------+---------------------------------------------------------
 i'd like for one of my plugins to have the ability to respond to XMPP
 headline messages, which appear in the dialog created by
 pidgin_notify_formatted(). this patch provides a hook for a plugin to
 modify the dialog before the user sees it. in addition to my particular
 need, it seems it could be useful for other things as well.

 {{{
 --- gtknotify.c 2009/10/11 21:18:28     1.1
 +++ gtknotify.c 2009/10/13 14:45:56
 @@ -830,6 +830,8 @@
         return options;
  }

 +void (*pidgin_notify_formatted_hook)() = NULL;
 +
  static void *
  pidgin_notify_formatted(const char *title, const char *primary,
                                                   const char *secondary,
 const char *text)
 @@ -883,6 +885,9 @@
         gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
         gtk_widget_show(frame);

 +       if (pidgin_notify_formatted_hook)
 +               (*pidgin_notify_formatted_hook)(window, title, primary,
 secondary, text);
 +
         /* Add the Close button. */
         button = gtk_dialog_add_button(GTK_DIALOG(window),
 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
         gtk_widget_grab_focus(button);

 }}}

--
Ticket URL: <http://developer.pidgin.im/ticket/10507>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-------------------+--------------------------------------------------------
 Reporter:  jts    |        Owner:              
     Type:  patch  |       Status:  new        
Milestone:         |    Component:  pidgin (gtk)
  Version:  2.6.2  |   Resolution:              
 Keywords:         |  
-------------------+--------------------------------------------------------
Changes (by jts):

  * type:  enhancement => patch


--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:1>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  pending    
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:              
 Keywords:                               |  
-----------------------------------------+----------------------------------
Changes (by QuLogic):

  * status:  new => pending
  * milestone:  => Patches Needing Improvement


Comment:

 This is really not the way to do this. First of all, how would you change
 `pidgin_notify_formatted_hook`? Instead of this, you could replace the
 notify uiop in libpurple and then call the original Pidgin implementation,
 but that's pretty ugly.

 Why not connect to the libpurple signal that signifies that the XMPP
 protocol has received an `<iq>` stanza and look for headlines?

--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:2>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  pending    
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:              
 Keywords:                               |  
-----------------------------------------+----------------------------------

Comment(by darkrain42):

 Replying to [comment:2 QuLogic]:
 > Why not connect to the libpurple signal that signifies that the XMPP
 protocol has received an `<iq>` stanza and look for headlines?

 `<message>`, but I agree. Is there a problem with the jabber-receiving-
 message signal?

--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:3>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  pending    
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:              
 Keywords:                               |  
-----------------------------------------+----------------------------------
Changes (by jts):

  * status:  pending => new


Comment:

 Thanks for the fast responses.

 pidgin_notify_formatted_hook is a global, so a plugin which declares it as
 an extern can assign to it.

 I want to add a "Reply to all" button to the headline message dialog,
 depending on the contents of the message. I think you guys are right that
 the jabber-receiving-message signal would work, but wouldn't that require
 duplicating all the code which reads the stanza and creates the dialog in
 order to add the button? That's certainly doable, but I was hoping to just
 piggyback on the existing code. Thanks.

--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:4>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  pending    
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:              
 Keywords:                               |  
-----------------------------------------+----------------------------------
Changes (by deryni):

  * status:  new => pending


Comment:

 Who will "Reply to all" reply to? Once you've hit the notify dialog there
 isn't really any indication of who/what/when/etc. caused the dialog to
 show up, so what would you want the button to do?

--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:5>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  new        
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:              
 Keywords:                               |  
-----------------------------------------+----------------------------------

Comment(by jts):

 deryni wrote:

 > Who will "Reply to all" reply to? Once you've hit the notify dialog
 there isn't really any
 > indication of who/what/when/etc. caused the dialog to show up, so what
 would you want the
 > button to do?

 (I'm explicitly including this because I don't see it in the ticket; I
 only got it in email. Sorry if I'm looking at the wrong thing.)

 My plugin creates a form where the user enters a message which is sent as
 a notification to multiple recipients, and all recipients' Jabber IDs show
 up in the message text. I want the recipients to be able to quickly reply-
 to-all. The plugin searches the start of the message for strings of the
 form "To <jabber ID>". If it finds a matching string(s), it creates the
 "Reply to all" button, configured to bring up the form for entering a
 message to send to the list of users from the search text and the original
 sender. Please let me know if this isn't clear or if there are
 questions/comments.

 That's my particular application, which has been written and works as
 described, but any plugin which wants to modify the notification form
 would probably find this patch useful. Thanks.

--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:5>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  pending    
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:              
 Keywords:                               |  
-----------------------------------------+----------------------------------
Changes (by deryni):

  * status:  new => pending


Comment:

 No offense, but I find your method of implementing this rather sub-
 optimal. I'd have much sooner used actual XMPP extension points to include
 the CC/etc. list of people in the stanza directly and then had the clients
 look for that instead of doing string parsing to find them, this would
 also mean that you could look for your messages specifically in the
 receiving-xmlnode signal and create your own dialog with that however you
 wanted.

 As it is, I still think that is a better general solution to this problem,
 hook up to one of the jabber receiving signals and do the processing of
 your stanzas yourself. Does that seem reasonable?

--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:6>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  pending    
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:              
 Keywords:                               |  
-----------------------------------------+----------------------------------
Changes (by jts):

  * status:  pending => new


Comment:

 "rather sub-optimal" - Ha, a man after my own heart... In my defense, I
 was trying to avoid re-creating GUI pieces, and the hook let me get the
 job done in a general/flexible way that gives a plugin control over parts
 of pidgin that otherwise couldn't be customized. Having said that, I do
 realize that searching for "To so-and-so" isn't terribly elegant and
 completely agree that using jabber-receiving-message is a reasonable
 solution for this particular problem. Thanks for the advice and feel free
 to consider this issue closed.

--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:7>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-----------------------------------------+----------------------------------
 Reporter:  jts                          |        Owner:              
     Type:  patch                        |       Status:  closed      
Milestone:  Patches Needing Improvement  |    Component:  pidgin (gtk)
  Version:  2.6.2                        |   Resolution:  wontfix    
 Keywords:                               |  
-----------------------------------------+----------------------------------
Changes (by deryni):

  * status:  new => closed
  * resolution:  => wontfix


--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:8>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker

Re: #10507: add hook to pidgin_notify_formatted()

by Pidgin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#10507: add hook to pidgin_notify_formatted()
-------------------+--------------------------------------------------------
 Reporter:  jts    |        Owner:              
     Type:  patch  |       Status:  closed      
Milestone:         |    Component:  pidgin (gtk)
  Version:  2.6.2  |   Resolution:  wontfix    
 Keywords:         |  
-------------------+--------------------------------------------------------
Changes (by Robby):

  * milestone:  Patches Needing Improvement =>


--
Ticket URL: <http://developer.pidgin.im/ticket/10507#comment:9>
Pidgin <http://pidgin.im>
Pidgin
_______________________________________________
Tracker mailing list
Tracker@...
http://pidgin.im/cgi-bin/mailman/listinfo/tracker