[Pidgin] #12205: Finch sound gntsound.c PURPLE_SOUND_GOT_ATTENTION

Pidgin trac at pidgin.im
Sun Jun 20 18:01:29 EDT 2010


#12205: Finch sound gntsound.c PURPLE_SOUND_GOT_ATTENTION
-------------------------------------------------------------+--------------
 Reporter:  cmdrwoody                                        |        Owner:  sadrul             
     Type:  defect                                           |       Status:  new                
Milestone:                                                   |    Component:  finch (gnt/ncurses)
  Version:  2.7.1                                            |   Resolution:                     
 Keywords:  finch sound gntsound PURPLE_SOUND_GOT_ATTENTION  |  
-------------------------------------------------------------+--------------
Description changed by cmdrwoody:

Old description:

> Need to add PURPLE_SOUND_GOT_ATTENTION to gntsound.c.  Otherwise calls to
> sounds[PURPLE_NUM_SOUNDS-1] will result in overflow. Example:
> Actions->Sounds segfaults.
>
> libpurple/sound.h:
>
> {{{
> typedef enum _PurpleSoundEventID
> {
>         PURPLE_SOUND_BUDDY_ARRIVE = 0, /**< Buddy signs on.
> */
>         PURPLE_SOUND_BUDDY_LEAVE,      /**< Buddy signs off.
> */
>         PURPLE_SOUND_RECEIVE,          /**< Receive an IM.
> */
>         PURPLE_SOUND_FIRST_RECEIVE,    /**< Receive an IM that starts a
> conv.     */
>         PURPLE_SOUND_SEND,             /**< Send an IM.
> */
>         PURPLE_SOUND_CHAT_JOIN,        /**< Someone joins a chat.
> */
>         PURPLE_SOUND_CHAT_LEAVE,       /**< Someone leaves a chat.
> */
>         PURPLE_SOUND_CHAT_YOU_SAY,     /**< You say something in a chat.
> */
>         PURPLE_SOUND_CHAT_SAY,         /**< Someone else says somthing in
> a chat. */
>         PURPLE_SOUND_POUNCE_DEFAULT,   /**< Default sound for a buddy
> pounce.     */
>         PURPLE_SOUND_CHAT_NICK,        /**< Someone says your name in a
> chat.     */
>         PURPLE_SOUND_GOT_ATTENTION,        /**< Got an attention
> */
>         PURPLE_NUM_SOUNDS              /**< Total number of sounds.
> */
>
> } PurpleSoundEventID;
> }}}
>
> finch/gntsound.c
>
> {{{
> static FinchSoundEvent sounds[PURPLE_NUM_SOUNDS] = {
>         {PURPLE_SOUND_BUDDY_ARRIVE, N_("Buddy logs in"), "login",
> "login.wav", NULL},
>         {PURPLE_SOUND_BUDDY_LEAVE,  N_("Buddy logs out"), "logout",
> "logout.wav", NULL},
>         {PURPLE_SOUND_RECEIVE,      N_("Message received"), "im_recv",
> "receive.wav", NULL},
>         {PURPLE_SOUND_FIRST_RECEIVE, N_("Message received begins
> conversation"), "first_im_recv", "receive.wav", NULL},
>         {PURPLE_SOUND_SEND,         N_("Message sent"), "send_im",
> "send.wav", NULL},
>         {PURPLE_SOUND_CHAT_JOIN,    N_("Person enters chat"),
> "join_chat", "login.wav", NULL},
>         {PURPLE_SOUND_CHAT_LEAVE,   N_("Person leaves chat"),
> "left_chat", "logout.wav", NULL},
>         {PURPLE_SOUND_CHAT_YOU_SAY, N_("You talk in chat"),
> "send_chat_msg", "send.wav", NULL},
>         {PURPLE_SOUND_CHAT_SAY,     N_("Others talk in chat"),
> "chat_msg_recv", "receive.wav", NULL},
>         {PURPLE_SOUND_POUNCE_DEFAULT, NULL, "pounce_default",
> "alert.wav", NULL},
>         {PURPLE_SOUND_CHAT_NICK,    N_("Someone says your username in
> chat"), "nick_said", "alert.wav", NULL}
> };
> }}}

New description:

 Need to add `PURPLE_SOUND_GOT_ATTENTION` to `gntsound.c`.  Otherwise calls
 to `sounds[PURPLE_NUM_SOUNDS-1]` will result in overflow. Example:
 Actions->Sounds segfaults.

 libpurple/sound.h:

 {{{
 typedef enum _PurpleSoundEventID
 {
         PURPLE_SOUND_BUDDY_ARRIVE = 0, /**< Buddy signs on.
 */
         PURPLE_SOUND_BUDDY_LEAVE,      /**< Buddy signs off.
 */
         PURPLE_SOUND_RECEIVE,          /**< Receive an IM.
 */
         PURPLE_SOUND_FIRST_RECEIVE,    /**< Receive an IM that starts a
 conv.     */
         PURPLE_SOUND_SEND,             /**< Send an IM.
 */
         PURPLE_SOUND_CHAT_JOIN,        /**< Someone joins a chat.
 */
         PURPLE_SOUND_CHAT_LEAVE,       /**< Someone leaves a chat.
 */
         PURPLE_SOUND_CHAT_YOU_SAY,     /**< You say something in a chat.
 */
         PURPLE_SOUND_CHAT_SAY,         /**< Someone else says somthing in
 a chat. */
         PURPLE_SOUND_POUNCE_DEFAULT,   /**< Default sound for a buddy
 pounce.     */
         PURPLE_SOUND_CHAT_NICK,        /**< Someone says your name in a
 chat.     */
         PURPLE_SOUND_GOT_ATTENTION,        /**< Got an attention
 */
         PURPLE_NUM_SOUNDS              /**< Total number of sounds.
 */

 } PurpleSoundEventID;
 }}}

 finch/gntsound.c

 {{{
 static FinchSoundEvent sounds[PURPLE_NUM_SOUNDS] = {
         {PURPLE_SOUND_BUDDY_ARRIVE, N_("Buddy logs in"), "login",
 "login.wav", NULL},
         {PURPLE_SOUND_BUDDY_LEAVE,  N_("Buddy logs out"), "logout",
 "logout.wav", NULL},
         {PURPLE_SOUND_RECEIVE,      N_("Message received"), "im_recv",
 "receive.wav", NULL},
         {PURPLE_SOUND_FIRST_RECEIVE, N_("Message received begins
 conversation"), "first_im_recv", "receive.wav", NULL},
         {PURPLE_SOUND_SEND,         N_("Message sent"), "send_im",
 "send.wav", NULL},
         {PURPLE_SOUND_CHAT_JOIN,    N_("Person enters chat"), "join_chat",
 "login.wav", NULL},
         {PURPLE_SOUND_CHAT_LEAVE,   N_("Person leaves chat"), "left_chat",
 "logout.wav", NULL},
         {PURPLE_SOUND_CHAT_YOU_SAY, N_("You talk in chat"),
 "send_chat_msg", "send.wav", NULL},
         {PURPLE_SOUND_CHAT_SAY,     N_("Others talk in chat"),
 "chat_msg_recv", "receive.wav", NULL},
         {PURPLE_SOUND_POUNCE_DEFAULT, NULL, "pounce_default", "alert.wav",
 NULL},
         {PURPLE_SOUND_CHAT_NICK,    N_("Someone says your username in
 chat"), "nick_said", "alert.wav", NULL}
 };
 }}}

--

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


More information about the Tracker mailing list