Changeset c0c43fb for protocols/oscar


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.