Changeset c0c43fb


Ignore:
Timestamp:
2008-12-14T10:31:49Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
ac46218
Parents:
939370c
Message:

Fixed ic->away leaking memory. This var is only used by OSCAR and should
maybe be killed. Also fixed some completely broken indentation in those
functions.

Location:
protocols
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r939370c rc0c43fb  
    320320        ic->acc->prpl->logout( ic );
    321321        b_event_remove( ic->inpa );
     322       
     323        g_free( ic->away );
     324        ic->away = NULL;
    322325       
    323326        u = irc->users;
  • protocols/nogaim.h

    r939370c rc0c43fb  
    239239 * the account_t parameter. */
    240240G_MODULE_EXPORT struct im_connection *imcb_new( account_t *acc );
    241 G_MODULE_EXPORT void imcb_free( struct im_connection *ic );
     241G_MODULE_EXPORT void imc_free( struct im_connection *ic );
    242242/* Once you're connected, you should call this function, so that the user will
    243243 * see the success. */
  • protocols/oscar/oscar.c

    r939370c rc0c43fb  
    19391939        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
    19401940
    1941         if (ic->away)
    1942                 g_free(ic->away);
     1941        g_free(ic->away);
    19431942        ic->away = NULL;
    19441943
     
    19601959static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
    19611960{
    1962     const char *msg = NULL;
     1961        const char *msg = NULL;
    19631962        gboolean no_message = FALSE;
    19641963
    19651964        /* clean old states */
    1966     if (ic->away) {
    1967                 g_free(ic->away);
    1968                 ic->away = NULL;
    1969     }
     1965        g_free(ic->away);
     1966        ic->away = NULL;
    19701967        od->sess->aim_icq_state = 0;
    19711968
    19721969        /* if no message, then use an empty message */
    1973     if (message) {
    1974         msg = message;
    1975     } else {
    1976         msg = "";
     1970        if (message) {
     1971                msg = message;
     1972        } else {
     1973                msg = "";
    19771974                no_message = TRUE;
    1978     }
     1975        }
    19791976
    19801977        if (!g_strcasecmp(state, "Online")) {
     
    19821979        } else if (!g_strcasecmp(state, "Away")) {
    19831980                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
    1984         ic->away = g_strdup(msg);
     1981                ic->away = g_strdup(msg);
    19851982                od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
    19861983        } else if (!g_strcasecmp(state, "Do Not Disturb")) {
    19871984                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
    1988         ic->away = g_strdup(msg);
     1985                ic->away = g_strdup(msg);
    19891986                od->sess->aim_icq_state = AIM_MTYPE_AUTODND;
    19901987        } else if (!g_strcasecmp(state, "Not Available")) {
    19911988                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
    1992         ic->away = g_strdup(msg);
     1989                ic->away = g_strdup(msg);
    19931990                od->sess->aim_icq_state = AIM_MTYPE_AUTONA;
    19941991        } else if (!g_strcasecmp(state, "Occupied")) {
    19951992                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
    1996         ic->away = g_strdup(msg);
     1993                ic->away = g_strdup(msg);
    19971994                od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY;
    19981995        } else if (!g_strcasecmp(state, "Free For Chat")) {
    19991996                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
    2000         ic->away = g_strdup(msg);
     1997                ic->away = g_strdup(msg);
    20011998                od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC;
    20021999        } else if (!g_strcasecmp(state, "Invisible")) {
    20032000                aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
    2004         ic->away = g_strdup(msg);
     2001                ic->away = g_strdup(msg);
    20052002        } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) {
    20062003                if (no_message) {
     
    20082005                } else {
    20092006                        aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
    2010             ic->away = g_strdup(msg);
     2007                        ic->away = g_strdup(msg);
    20112008                        od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
    20122009                }
     
    20202017        struct oscar_data *od = (struct oscar_data *)ic->proto_data;
    20212018
    2022     oscar_set_away_aim(ic, od, state, message);
     2019        oscar_set_away_aim(ic, od, state, message);
    20232020        if (od->icq)
    20242021                oscar_set_away_icq(ic, od, state, message);
  • protocols/yahoo/yahoo.c

    r939370c rc0c43fb  
    197197{
    198198        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    199        
    200         ic->away = NULL;
     199        char *away;
     200       
     201        away = NULL;
    201202       
    202203        if( state && msg && g_strcasecmp( state, msg ) != 0 )
    203204        {
    204205                yd->current_status = YAHOO_STATUS_CUSTOM;
    205                 ic->away = "";
     206                away = "";
    206207        }
    207208        else if( state )
     
    212213                msg = NULL;
    213214               
    214                 ic->away = "";
     215                away = "";
    215216                if( g_strcasecmp( state, "Available" ) == 0 )
    216217                {
    217218                        yd->current_status = YAHOO_STATUS_AVAILABLE;
    218                         ic->away = NULL;
     219                        away = NULL;
    219220                }
    220221                else if( g_strcasecmp( state, "Be Right Back" ) == 0 )
     
    242243                        yd->current_status = YAHOO_STATUS_AVAILABLE;
    243244                       
    244                         ic->away = NULL;
     245                        away = NULL;
    245246                }
    246247        }
     
    248249                yd->current_status = YAHOO_STATUS_AVAILABLE;
    249250       
    250         yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL ? 2 : 0 );
     251        yahoo_set_away( yd->y2_id, yd->current_status, msg, away != NULL ? 2 : 0 );
    251252}
    252253
Note: See TracChangeset for help on using the changeset viewer.