# HG changeset patch # User Tim Ringenbach # Date 1087188674 0 # Node ID 2401a9ef74a0a85cd676af73c665e34e3975a5e9 # Parent 185fbd8b5998878677522f27b096e6fb636677ca [gaim-migrate @ 10081] Some reorganization. Renamed struct yahoo_friend to YahooFriend. Gave it its own file, which only has two functions. Either I've lost it or I intend to add to it. You decide. committer: Tailor Script diff -r 185fbd8b5998 -r 2401a9ef74a0 src/protocols/yahoo/Makefile.am --- a/src/protocols/yahoo/Makefile.am Mon Jun 14 00:54:45 2004 +0000 +++ b/src/protocols/yahoo/Makefile.am Mon Jun 14 04:51:14 2004 +0000 @@ -14,6 +14,8 @@ util.c \ yahoo_filexfer.h \ yahoo_filexfer.c \ + yahoo_friend.h \ + yahoo_friend.c \ yahoo_profile.c AM_CFLAGS = $(st) diff -r 185fbd8b5998 -r 2401a9ef74a0 src/protocols/yahoo/Makefile.mingw --- a/src/protocols/yahoo/Makefile.mingw Mon Jun 14 00:54:45 2004 +0000 +++ b/src/protocols/yahoo/Makefile.mingw Mon Jun 14 04:51:14 2004 +0000 @@ -73,6 +73,7 @@ yahoochat.c \ yahoo_filexfer.c \ yahoo_profile.c \ + yahoo_friend.c \ crypt.c \ util.c diff -r 185fbd8b5998 -r 2401a9ef74a0 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Mon Jun 14 00:54:45 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Mon Jun 14 04:51:14 2004 +0000 @@ -36,6 +36,7 @@ #include "sha.h" #include "yahoo.h" +#include "yahoo_friend.h" #include "yahoochat.h" #include "yahoo_auth.h" #include "yahoo_filexfer.h" @@ -47,25 +48,6 @@ static void yahoo_add_buddy(GaimConnection *gc, const char *who, GaimGroup *); -static struct yahoo_friend *yahoo_friend_new(void) -{ - struct yahoo_friend *ret; - - ret = g_new0(struct yahoo_friend, 1); - ret->status = YAHOO_STATUS_OFFLINE; - - return ret; -} - -static void yahoo_friend_free(gpointer p) -{ - struct yahoo_friend *f = p; - if (f->msg) - g_free(f->msg); - if (f->game) - g_free(f->game); - g_free(f); -} struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id) { @@ -274,7 +256,7 @@ g_free(pkt); } -static void yahoo_update_status(GaimConnection *gc, const char *name, struct yahoo_friend *f) +static void yahoo_update_status(GaimConnection *gc, const char *name, YahooFriend *f) { int online = 1; @@ -292,7 +274,7 @@ struct yahoo_data *yd = gc->proto_data; GaimAccount *account = gaim_connection_get_account(gc); GSList *l = pkt->hash; - struct yahoo_friend *f = NULL; + YahooFriend *f = NULL; char *name = NULL; if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { @@ -553,7 +535,7 @@ gboolean got_serv_list = FALSE; GaimBuddy *b; GaimGroup *g; - struct yahoo_friend *f = NULL; + YahooFriend *f = NULL; GaimAccount *account = gaim_connection_get_account(gc); struct yahoo_data *yd = gc->proto_data; GHashTable *ht; @@ -666,7 +648,7 @@ char *from = NULL; char *stat = NULL; char *game = NULL; - struct yahoo_friend *f = NULL; + YahooFriend *f = NULL; GSList *l = pkt->hash; GaimAccount *account = gaim_connection_get_account(gc); struct yahoo_data *yd = (struct yahoo_data*) gc->proto_data; @@ -1772,7 +1754,7 @@ char *group = NULL; char *decoded_group; char *buf; - struct yahoo_friend *f; + YahooFriend *f; struct yahoo_data *yd = gc->proto_data; GSList *l = pkt->hash; @@ -2341,7 +2323,7 @@ GaimAccount *account; GaimConnection *gc; struct yahoo_data *yd; - struct yahoo_friend *f; + YahooFriend *f; if (!b || !(account = b->account) || !(gc = gaim_account_get_connection(account)) || !(yd = gc->proto_data)) @@ -2438,7 +2420,7 @@ char *game = NULL; char *t; char url[256]; - struct yahoo_friend *f; + YahooFriend *f; g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); @@ -2466,7 +2448,7 @@ static char *yahoo_status_text(GaimBuddy *b) { struct yahoo_data *yd = (struct yahoo_data*)b->account->gc->proto_data; - struct yahoo_friend *f = NULL; + YahooFriend *f = NULL; f = g_hash_table_lookup(yd->friends, b->name); if (!f) @@ -2492,7 +2474,7 @@ char *yahoo_tooltip_text(GaimBuddy *b) { struct yahoo_data *yd = (struct yahoo_data*)b->account->gc->proto_data; - struct yahoo_friend *f; + YahooFriend *f; char *escaped, *status, *ret; f = g_hash_table_lookup(yd->friends, b->name); @@ -2574,7 +2556,7 @@ GaimConnection *gc = gaim_account_get_connection(buddy->account); struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; static char buf2[1024]; - struct yahoo_friend *f; + YahooFriend *f; f = g_hash_table_lookup(yd->friends, buddy->name); @@ -2933,7 +2915,7 @@ static void yahoo_remove_buddy(GaimConnection *gc, const char *who, const char *group) { struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; - struct yahoo_friend *f; + YahooFriend *f; struct yahoo_packet *pkt; GSList *buddies, *l; GaimGroup *g; diff -r 185fbd8b5998 -r 2401a9ef74a0 src/protocols/yahoo/yahoo.h --- a/src/protocols/yahoo/yahoo.h Mon Jun 14 00:54:45 2004 +0000 +++ b/src/protocols/yahoo/yahoo.h Mon Jun 14 04:51:14 2004 +0000 @@ -160,17 +160,6 @@ GSList *hash; }; -struct yahoo_friend { /* we'll call them friends, so we don't confuse them with GaimBuddy */ - enum yahoo_status status; - char *msg; - char *game; - int idle; - int away; - gboolean sms; - char *ip; - guint bicon_checksum; - gboolean bicon_have; -}; #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (48) diff -r 185fbd8b5998 -r 2401a9ef74a0 src/protocols/yahoo/yahoo_friend.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/protocols/yahoo/yahoo_friend.c Mon Jun 14 04:51:14 2004 +0000 @@ -0,0 +1,46 @@ +/* + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "prpl.h" + +#include "yahoo_friend.h" + +YahooFriend *yahoo_friend_new(void) +{ + YahooFriend *ret; + + ret = g_new0(YahooFriend, 1); + ret->status = YAHOO_STATUS_OFFLINE; + + return ret; +} + +void yahoo_friend_free(gpointer p) +{ + YahooFriend *f = p; + if (f->msg) + g_free(f->msg); + if (f->game) + g_free(f->game); + g_free(f); +} diff -r 185fbd8b5998 -r 2401a9ef74a0 src/protocols/yahoo/yahoo_friend.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/protocols/yahoo/yahoo_friend.h Mon Jun 14 04:51:14 2004 +0000 @@ -0,0 +1,48 @@ +/** + * @file yahoo_friend.h The Yahoo! protocol plugin YahooFriend object + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _YAHOO_FRIEND_H_ +#define _YAHOO_FRIEND_H_ + +#include "yahoo.h" + +/* these are called friends instead of buddies mainly so I can use variables + * named f and not confuse them with variables named b + */ +typedef struct _YahooFriend { + enum yahoo_status status; + char *msg; + char *game; + int idle; + int away; + gboolean sms; + char *ip; + guint bicon_checksum; + gboolean bicon_have; +} YahooFriend; + +YahooFriend *yahoo_friend_new(void); +void yahoo_friend_free(gpointer p); + +#endif /* _YAHOO_FRIEND_H_ */