Mercurial > pidgin
changeset 9927:fb08a0973b3e
[gaim-migrate @ 10819]
" Currently, the "loggedin" parameter of
serv_got_update() is of type int and used as a boolean.
I updated it and all references to be gboolean.
I also noticed that "presence" in
gaim_blist_update_buddy_presence() is also a really
boolean. of whether or not the buddy is currently
online. There seemed to be some confusion,
particularly in the silc plugin which tried to use a
GaimBuddyPresenceState (coincidentally (or perhaps not)
GAIM_BUDDY_OFFLINE and GAIM_BUDDY_ONLINE work as FALSE
and TRUE respectively). The value passed to
gaim_blist_update_buddy_presence() doesn't directly
become the buddy presence state and this patch helps
avoid confusion in this respect." --Daniel Atallah
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 01 Sep 2004 01:07:42 +0000 |
parents | b23e70bd1215 |
children | 5d8d73c2eebe |
files | src/blist.c src/blist.h src/protocols/gg/gg.c src/protocols/icq/gaim_icq.c src/protocols/irc/msgs.c src/protocols/jabber/presence.c src/protocols/jabber/roster.c src/protocols/msn/notification.c src/protocols/napster/napster.c src/protocols/novell/novell.c src/protocols/oscar/oscar.c src/protocols/rendezvous/rendezvous.c src/protocols/silc/buddy.c src/protocols/silc/ops.c src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c src/protocols/zephyr/zephyr.c src/server.c src/server.h |
diffstat | 20 files changed, 61 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/src/blist.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/blist.c Wed Sep 01 01:07:42 2004 +0000 @@ -290,14 +290,14 @@ return FALSE; } -void gaim_blist_update_buddy_presence(GaimBuddy *buddy, int presence) +void gaim_blist_update_buddy_presence(GaimBuddy *buddy, gboolean online) { GaimBlistUiOps *ops = gaimbuddylist->ui_ops; gboolean did_something = FALSE; g_return_if_fail(buddy != NULL); - if (!GAIM_BUDDY_IS_ONLINE(buddy) && presence) { + if (!GAIM_BUDDY_IS_ONLINE(buddy) && online) { int old_present = buddy->present; buddy->present = GAIM_BUDDY_SIGNING_ON; gaim_signal_emit(gaim_blist_get_handle(), "buddy-signed-on", buddy); @@ -308,7 +308,7 @@ if (((GaimContact*)((GaimBlistNode*)buddy)->parent)->online == 1) ((GaimGroup *)((GaimBlistNode *)buddy)->parent->parent)->online++; } - } else if (GAIM_BUDDY_IS_ONLINE(buddy) && !presence) { + } else if (GAIM_BUDDY_IS_ONLINE(buddy) && !online) { buddy->present = GAIM_BUDDY_SIGNING_OFF; gaim_signal_emit(gaim_blist_get_handle(), "buddy-signed-off", buddy); did_something = TRUE;
--- a/src/blist.h Wed Sep 01 00:48:38 2004 +0000 +++ b/src/blist.h Wed Sep 01 01:07:42 2004 +0000 @@ -263,9 +263,9 @@ * Updates a buddy's presence. * * @param buddy The buddy whose presence has changed - * @param presence The new presence + * @param online If the buddy is now online */ -void gaim_blist_update_buddy_presence(GaimBuddy *buddy, int presence); +void gaim_blist_update_buddy_presence(GaimBuddy *buddy, gboolean online); /** * Updates a buddy's signon time.
--- a/src/protocols/gg/gg.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/gg/gg.c Wed Sep 01 01:07:42 2004 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 10809 2004-08-31 01:45:12Z lschiere $ + * $Id: gg.c 10819 2004-09-01 01:07:42Z lschiere $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -507,8 +507,8 @@ } g_snprintf(user, sizeof(user), "%lu", n->uin); - serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? 0 : 1, 0, 0, 0, - status); + serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? FALSE : TRUE, 0, 0, + 0, status); n++; } } @@ -552,8 +552,8 @@ buddy->proto_data = g_strdup(e->event.notify60[i].descr); } - serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? 0 : 1, 0, 0, 0, - status); + serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? FALSE : TRUE, 0, 0, + 0, status); i++; } } @@ -578,8 +578,8 @@ } g_snprintf(user, sizeof(user), "%lu", e->event.status.uin); - serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? 0 : 1, 0, 0, 0, - status); + serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? FALSE : TRUE, 0, 0, + 0, status); } break; case GG_EVENT_STATUS60: @@ -619,8 +619,8 @@ buddy->proto_data = g_strdup(e->event.status60.descr); } - serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? 0 : 1, 0, 0, 0, - status); + serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? FALSE : TRUE, 0, 0, + 0, status); } break; case GG_EVENT_ACK:
--- a/src/protocols/icq/gaim_icq.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/icq/gaim_icq.c Wed Sep 01 01:07:42 2004 +0000 @@ -117,13 +117,13 @@ g_snprintf(buf, sizeof buf, "%lu", uin); status = (st == STATUS_ONLINE) ? 0 : UC_UNAVAILABLE | (st << 1); - serv_got_update(gc, buf, 1, 0, 0, 0, status); + serv_got_update(gc, buf, TRUE, 0, 0, 0, status); } static void icq_user_offline(icq_Link *link, unsigned long uin) { struct gaim_connection *gc = link->icq_UserData; char buf[256]; g_snprintf(buf, sizeof buf, "%lu", uin); - serv_got_update(gc, buf, 0, 0, 0, 0, 0); + serv_got_update(gc, buf, FALSE, 0, 0, 0, 0); } static void icq_user_status(icq_Link *link, unsigned long uin, unsigned long st) { @@ -133,7 +133,7 @@ g_snprintf(buf, sizeof buf, "%lu", uin); status = (st == STATUS_ONLINE) ? 0 : UC_UNAVAILABLE | (st << 1); - serv_got_update(gc, buf, 1, 0, 0, 0, status); + serv_got_update(gc, buf, TRUE, 0, 0, 0, status); } static gboolean icq_set_timeout_cb(gpointer data) {
--- a/src/protocols/irc/msgs.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/irc/msgs.c Wed Sep 01 01:07:42 2004 +0000 @@ -555,12 +555,12 @@ return; if (ib->online && !ib->flag) { - serv_got_update(gc, buddy->name, 0, 0, 0, 0, 0); + serv_got_update(gc, buddy->name, FALSE, 0, 0, 0, 0); ib->online = FALSE; } if (!ib->online && ib->flag) { - serv_got_update(gc, buddy->name, 1, 0, 0, 0, 0); + serv_got_update(gc, buddy->name, TRUE, 0, 0, 0, 0); ib->online = TRUE; } }
--- a/src/protocols/jabber/presence.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/jabber/presence.c Wed Sep 01 01:07:42 2004 +0000 @@ -77,9 +77,9 @@ jabber_buddy_track_resource(jb, js->user->resource, 0, state, (msg && *msg) ? msg : NULL); } if((jbr = jabber_buddy_find_resource(jb, NULL))) - serv_got_update(js->gc, my_base_jid, 1, 0, 0, 0, jbr->state); + serv_got_update(js->gc, my_base_jid, TRUE, 0, 0, 0, jbr->state); else - serv_got_update(js->gc, my_base_jid, 0, 0, 0, 0, 0); + serv_got_update(js->gc, my_base_jid, FALSE, 0, 0, 0, 0); } } g_free(my_base_jid); @@ -456,10 +456,10 @@ } if((jbr = jabber_buddy_find_resource(jb, NULL))) - serv_got_update(js->gc, buddy_name, 1, 0, b->signon, b->idle, + serv_got_update(js->gc, buddy_name, TRUE, 0, b->signon, b->idle, jbr->state); else - serv_got_update(js->gc, buddy_name, 0, 0, 0, 0, 0); + serv_got_update(js->gc, buddy_name, FALSE, 0, 0, 0, 0); g_free(buddy_name); }
--- a/src/protocols/jabber/roster.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/jabber/roster.c Wed Sep 01 01:07:42 2004 +0000 @@ -274,7 +274,7 @@ else if(!jb || !(jb->subscription & JABBER_SUB_TO)) jabber_presence_subscription_set(js, who, "subscribe"); else if((jbr =jabber_buddy_find_resource(jb, NULL))) - serv_got_update(gc, who, 1, 0, 0, 0, jbr->state); + serv_got_update(gc, who, TRUE, 0, 0, 0, jbr->state); g_free(my_bare_jid); g_free(who);
--- a/src/protocols/msn/notification.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/msn/notification.c Wed Sep 01 01:07:42 2004 +0000 @@ -453,7 +453,7 @@ gc = cmdproc->session->account->gc; - serv_got_update(gc, cmd->params[0], 0, 0, 0, 0, 0); + serv_got_update(gc, cmd->params[0], FALSE, 0, 0, 0, 0); } static void @@ -507,7 +507,7 @@ else if (!g_ascii_strcasecmp(state, "LUN")) status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); - serv_got_update(gc, passport, 1, 0, 0, idle, status); + serv_got_update(gc, passport, TRUE, 0, 0, idle, status); } static void @@ -582,7 +582,7 @@ else if (!g_ascii_strcasecmp(state, "LUN")) status |= UC_UNAVAILABLE | (MSN_LUNCH << 1); - serv_got_update(gc, passport, 1, 0, 0, idle, status); + serv_got_update(gc, passport, TRUE, 0, 0, idle, status); } static void
--- a/src/protocols/napster/napster.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/napster/napster.c Wed Sep 01 01:07:42 2004 +0000 @@ -282,12 +282,12 @@ case 201: /* MSG_SERVER_SEARCH_RESULT */ res = g_strsplit(buf, " ", 0); - serv_got_update(gc, res[0], 1, 0, 0, 0, 0); + serv_got_update(gc, res[0], TRUE, 0, 0, 0, 0); g_strfreev(res); break; case 202: /* MSG_SERVER_SEARCH_END */ - serv_got_update(gc, buf, 0, 0, 0, 0, 0); + serv_got_update(gc, buf, FALSE, 0, 0, 0, 0); break; case 205: /* MSG_CLIENT_PRIVMSG */ @@ -301,14 +301,14 @@ case 209: /* MSG_SERVER_USER_SIGNON */ /* USERNAME SPEED */ res = g_strsplit(buf, " ", 2); - serv_got_update(gc, res[0], 1, 0, 0, 0, 0); + serv_got_update(gc, res[0], TRUE, 0, 0, 0, 0); g_strfreev(res); break; case 210: /* MSG_SERVER_USER_SIGNOFF */ /* USERNAME SPEED */ res = g_strsplit(buf, " ", 2); - serv_got_update(gc, res[0], 0, 0, 0, 0, 0); + serv_got_update(gc, res[0], FALSE, 0, 0, 0, 0); g_strfreev(res); break;
--- a/src/protocols/novell/novell.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/novell/novell.c Wed Sep 01 01:07:42 2004 +0000 @@ -1149,7 +1149,7 @@ GaimConnection *gc = gaim_account_get_connection(buddy->account); int gstatus = status << 1; int idle = 0; - int loggedin = 1; + gboolean loggedin = TRUE; switch (status) { case NM_STATUS_AVAILABLE: @@ -1160,7 +1160,7 @@ gstatus |= UC_UNAVAILABLE; break; case NM_STATUS_OFFLINE: - loggedin = 0; + loggedin = FALSE; gstatus |= UC_UNAVAILABLE; break; case NM_STATUS_AWAY_IDLE: @@ -1169,7 +1169,7 @@ break; default: gstatus |= UC_UNAVAILABLE; - loggedin = 0; + loggedin = FALSE; break; }
--- a/src/protocols/oscar/oscar.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/oscar/oscar.c Wed Sep 01 01:07:42 2004 +0000 @@ -2966,7 +2966,7 @@ gc->login_time_official = signon; } - serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); + serv_got_update(gc, info->sn, TRUE, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); return 1; } @@ -2988,7 +2988,7 @@ info = va_arg(ap, aim_userinfo_t *); va_end(ap); - serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); + serv_got_update(gc, info->sn, FALSE, 0, 0, 0, 0); g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn));
--- a/src/protocols/rendezvous/rendezvous.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/rendezvous/rendezvous.c Wed Sep 01 01:07:42 2004 +0000 @@ -114,7 +114,7 @@ b = gaim_buddy_new(account, name, NULL); /* gaim_blist_node_set_flag(b, GAIM_BLIST_NODE_FLAG_NO_SAVE); */ gaim_blist_add_buddy(b, NULL, g, NULL); - serv_got_update(gc, b->name, 1, 0, 0, 0, 0); + serv_got_update(gc, b->name, TRUE, 0, 0, 0, 0); #if 0 RendezvousBuddy *rb; @@ -144,7 +144,7 @@ if (b == NULL) return; - serv_got_update(gc, b->name, 0, 0, 0, 0, 0); + serv_got_update(gc, b->name, FALSE, 0, 0, 0, 0); gaim_blist_remove_buddy(b); /* XXX - This results in incorrect group counts--needs to be fixed in the core */ /* XXX - We also need to call remove_idle_buddy() in server.c for idle buddies */ @@ -176,7 +176,7 @@ b = (GaimBuddy *)bnode; if (b->account != account) continue; - serv_got_update(gc, b->name, 0, 0, 0, 0, 0); + serv_got_update(gc, b->name, FALSE, 0, 0, 0, 0); gaim_blist_remove_buddy(b); } } @@ -264,7 +264,7 @@ /* Away */ rb->status = UC_UNAVAILABLE; } - serv_got_update(gc, name, 1, 0, 0, rb->idle, rb->status); + serv_got_update(gc, name, TRUE, 0, 0, rb->idle, rb->status); } node1 = mdns_txt_find(rdata, "msg");
--- a/src/protocols/silc/buddy.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/silc/buddy.c Wed Sep 01 01:07:42 2004 +0000 @@ -732,7 +732,7 @@ _("You cannot receive buddy notifications until you " "import his/her public key. You can use the Get Public Key " "command to get the public key.")); - gaim_blist_update_buddy_presence(r->b, GAIM_BUDDY_OFFLINE); + gaim_blist_update_buddy_presence(r->b, FALSE); } static void @@ -771,7 +771,7 @@ "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", silcgaim_silcdir(), fingerprint); gaim_blist_node_set_string((GaimBlistNode *)b, "public-key", filename); - gaim_blist_update_buddy_presence(r->b, GAIM_BUDDY_OFFLINE); + gaim_blist_update_buddy_presence(r->b, FALSE); silc_free(fingerprint); silc_free(r->offline_pk); silc_free(r); @@ -963,7 +963,7 @@ gaim_blist_node_set_string((GaimBlistNode *)b, "public-key", filename); /* Update online status on the buddy list */ - gaim_blist_update_buddy_presence(b, GAIM_BUDDY_ONLINE); + gaim_blist_update_buddy_presence(b, TRUE); /* Finally, start watching this user so we receive its status changes from the server */
--- a/src/protocols/silc/ops.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/silc/ops.c Wed Sep 01 01:07:42 2004 +0000 @@ -708,7 +708,7 @@ client_entry->mode & SILC_UMODE_PAGE || client_entry->mode & SILC_UMODE_DETACHED)) { client_entry->mode = mode; - gaim_blist_update_buddy_presence(b, GAIM_BUDDY_ONLINE); + gaim_blist_update_buddy_presence(b, TRUE); } else if ((mode & SILC_UMODE_GONE) || (mode & SILC_UMODE_INDISPOSED) || @@ -716,16 +716,16 @@ (mode & SILC_UMODE_PAGE) || (mode & SILC_UMODE_DETACHED)) { client_entry->mode = mode; - gaim_blist_update_buddy_presence(b, GAIM_BUDDY_OFFLINE); + gaim_blist_update_buddy_presence(b, FALSE); } } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || notify == SILC_NOTIFY_TYPE_KILLED) { client_entry->mode = mode; - gaim_blist_update_buddy_presence(b, GAIM_BUDDY_OFFLINE); + gaim_blist_update_buddy_presence(b, FALSE); } else if (notify == SILC_NOTIFY_TYPE_NONE) { client_entry->mode = mode; - gaim_blist_update_buddy_presence(b, GAIM_BUDDY_ONLINE); + gaim_blist_update_buddy_presence(b, TRUE); } } break;
--- a/src/protocols/toc/toc.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/toc/toc.c Wed Sep 01 01:07:42 2004 +0000 @@ -719,7 +719,8 @@ serv_got_im(gc, c, message, a, time(NULL)); } else if (!g_ascii_strcasecmp(c, "UPDATE_BUDDY")) { char *l, *uc, *tmp; - int logged, evil, idle, type = 0; + gboolean logged_in; + int evil, idle, type = 0; time_t signon, time_idle; c = strtok(NULL, ":"); /* name */ @@ -729,7 +730,7 @@ sscanf(strtok(NULL, ":"), "%d", &idle); uc = strtok(NULL, ":"); - logged = (l && (*l == 'T')) ? 1 : 0; + logged_in = (l && (*l == 'T')) ? TRUE : FALSE; if (uc[0] == 'A') type |= UC_AOL; @@ -770,7 +771,7 @@ } g_free(tmp); - serv_got_update(gc, c, logged, evil, signon, time_idle, type); + serv_got_update(gc, c, logged_in, evil, signon, time_idle, type); } else if (!g_ascii_strcasecmp(c, "ERROR")) { gaim_notify_error(gc, NULL, show_error_message(), NULL); } else if (!g_ascii_strcasecmp(c, "EVILED")) {
--- a/src/protocols/trepia/trepia.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/trepia/trepia.c Wed Sep 01 01:07:42 2004 +0000 @@ -842,7 +842,7 @@ g_hash_table_insert(session->user_profiles, int_p, profile); serv_got_update(session->gc, - username, 1, 0, + username, TRUE, 0, trepia_profile_get_login_time(profile), 0, 0); /* Buddy Icon */ @@ -857,7 +857,7 @@ g_free(icon); - serv_got_update(session->gc, username, 1, 0, 0, 0, 0); + serv_got_update(session->gc, username, TRUE, 0, 0, 0, 0); } /* @@ -892,7 +892,7 @@ if (b != NULL) serv_got_update(session->gc, trepia_profile_get_login(profile), - 0, 0, 0, 0, 0); + FALSE, 0, 0, 0, 0); gaim_blist_remove_buddy(b);
--- a/src/protocols/yahoo/yahoo.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Wed Sep 01 01:07:42 2004 +0000 @@ -315,13 +315,13 @@ static void yahoo_update_status(GaimConnection *gc, const char *name, YahooFriend *f) { - int online = 1; + gboolean online = TRUE; if (!gc || !name || !f || !gaim_find_buddy(gaim_connection_get_account(gc), name)) return; if (f->status == YAHOO_STATUS_OFFLINE) - online = 0; + online = FALSE; serv_got_update(gc, name, online, 0, 0, f->idle, f->away ? UC_UNAVAILABLE : 0); } @@ -437,7 +437,7 @@ if (strtol(pair->value, NULL, 10) == 0) { if (f) f->status = YAHOO_STATUS_OFFLINE; - serv_got_update(gc, name, 0, 0, 0, 0, 0); + serv_got_update(gc, name, FALSE, 0, 0, 0, 0); break; } @@ -947,7 +947,7 @@ gaim_notify_info(gc, NULL, _("Add buddy rejected"), buf->str); g_string_free(buf, TRUE); g_hash_table_remove(yd->friends, who); - serv_got_update(gc, who, 0, 0, 0, 0, 0); + serv_got_update(gc, who, FALSE, 0, 0, 0, 0); } }
--- a/src/protocols/zephyr/zephyr.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/protocols/zephyr/zephyr.c Wed Sep 01 01:07:42 2004 +0000 @@ -720,7 +720,7 @@ str->str, NULL, NULL); g_string_free(str, TRUE); } else - serv_got_update(gc, b->name, nlocs, 0, 0, 0, 0); + serv_got_update(gc, b->name, (nlocs > 0) ? TRUE : FALSE, 0, 0, 0, 0); g_free(user); }
--- a/src/server.c Wed Sep 01 00:48:38 2004 +0000 +++ b/src/server.c Wed Sep 01 01:07:42 2004 +0000 @@ -1142,7 +1142,7 @@ * @param idle The time at which the buddy became idle, in seconds * since the epoch. */ -void serv_got_update(GaimConnection *gc, const char *name, int loggedin, +void serv_got_update(GaimConnection *gc, const char *name, gboolean loggedin, int evil, time_t signon, time_t idle, int type) { GaimAccount *account;
--- a/src/server.h Wed Sep 01 00:48:38 2004 +0000 +++ b/src/server.h Wed Sep 01 01:07:42 2004 +0000 @@ -85,7 +85,7 @@ void serv_got_typing_stopped(GaimConnection *gc, const char *name); void serv_got_im(GaimConnection *gc, const char *who, const char *msg, GaimConvImFlags imflags, time_t mtime); -void serv_got_update(GaimConnection *gc, const char *name, int loggedin, +void serv_got_update(GaimConnection *gc, const char *name, gboolean loggedin, int evil, time_t signon, time_t idle, int type); void serv_finish_login(GaimConnection *gc); void serv_got_chat_invite(GaimConnection *gc, const char *name,