[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.31,1.32
From: |
Philip S Tellis <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.31,1.32 |
Date: |
Wed, 29 Jan 2003 10:25:57 -0500 |
Update of /cvsroot/ayttm/ayttm/modules/yahoo2
In directory subversions:/tmp/cvs-serv29638/modules/yahoo2
Modified Files:
yahoo.c
Log Message:
set yahoo addressbook, implement change_user_name and free_account_data
Index: yahoo.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/yahoo2/yahoo.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- yahoo.c 28 Jan 2003 10:42:24 -0000 1.31
+++ yahoo.c 29 Jan 2003 15:25:55 -0000 1.32
@@ -222,27 +222,48 @@
#endif
typedef struct {
- gint status;
- gint away;
- gchar *status_message;
- gint typing_timeout_tag;
+ int status;
+ int away;
+ char *status_message;
+ int typing_timeout_tag;
} eb_yahoo_account_data;
+static void free_yahoo_account(eb_yahoo_account_data * yad)
+{
+ if(yad->status_message)
+ free(yad->status_message);
+
+ free(yad);
+}
+
+static void eb_yahoo_free_account_data(eb_account * account)
+{
+ free_yahoo_account(account->protocol_account_data);
+}
+
typedef struct {
char password[255];
char *act_id;
int fd;
int id;
- gint input;
- gint ping_timeout_tag;
+ int input;
+ int ping_timeout_tag;
int status;
char *status_message;
int away;
} eb_yahoo_local_account_data;
+static void free_yahoo_local_account(eb_yahoo_local_account_data * yla)
+{
+ if(yla->status_message)
+ free(yla->status_message);
+
+ free(yla);
+}
+
typedef struct {
- gint32 id;
- gchar *to_handle;
+ int id;
+ char *to_handle;
} eb_ext_yahoo_typing_notify_data;
typedef struct {
@@ -257,10 +278,10 @@
typedef struct {
int id;
- gchar *host;
- gchar *room;
+ char *host;
+ char *room;
YList *members;
- gboolean connected;
+ int connected;
} eb_yahoo_chat_room_data;
typedef struct {
@@ -370,10 +391,10 @@
static void eb_yahoo_add_user(eb_account * ea);
static void eb_yahoo_login_with_state(eb_local_account * ela, int login_mode);
static void eb_yahoo_logout(eb_local_account * ela);
-static eb_account *eb_yahoo_new_account(gchar * account);
+static eb_account *eb_yahoo_new_account(char * account);
-static gint eb_yahoo_ping_timeout_callback(gpointer data)
+static int eb_yahoo_ping_timeout_callback(gpointer data)
{
eb_yahoo_local_account_data *ylad = data;
yahoo_keepalive(ylad->id);
@@ -619,7 +640,7 @@
for(buddy = buds; buddy; buddy=buddy->next) {
struct yahoo_buddy *bud = buddy->data;
- gchar *contact_name;
+ char *contact_name;
struct contact *con;
/*
@@ -649,9 +670,6 @@
con = find_contact_by_nick(bud->id);
if(!con) {
changed = 1;
- if(!find_grouplist_by_name(bud->group)) {
- add_group(bud->group);
- }
con=add_new_contact(bud->group, contact_name,
SERVICE_INFO.protocol_id);
}
ea = eb_yahoo_new_account(bud->id);
@@ -671,7 +689,7 @@
for(; ign; ign = ign->next) {
struct yahoo_buddy *bud = ign->data;
- gchar *contact_name;
+ char *contact_name;
struct contact *con;
/*
@@ -774,7 +792,7 @@
/*************************************
* File transfer code starts here
*/
-static void eb_yahoo_save_file_callback(gpointer data, gint fd,
+static void eb_yahoo_save_file_callback(gpointer data, int fd,
eb_input_condition cond)
{
eb_yahoo_file_transfer_data *yftd = data;
@@ -894,7 +912,7 @@
eb_do_dialog(buff, _("Yahoo File Transfer"), eb_yahoo_accept_file,
yftd);
}
-static void eb_yahoo_send_file_callback(gpointer data, gint fd,
+static void eb_yahoo_send_file_callback(gpointer data, int fd,
eb_input_condition cond)
{
eb_yahoo_file_transfer_data *yftd = data;
@@ -1219,7 +1237,7 @@
eb_chat_room_show_message(chat_room, who, umsg);
}
-static void eb_yahoo_send_chat_room_message(eb_chat_room * room, gchar *
message)
+static void eb_yahoo_send_chat_room_message(eb_chat_room * room, char *
message)
{
eb_yahoo_chat_room_data *ycrd;
eb_yahoo_local_account_data *ylad;
@@ -1396,7 +1414,7 @@
eb_do_dialog(buff, _("Yahoo New Contact"), eb_yahoo_authorize_callback,
ay);
}
-static gint eb_yahoo_send_typing_stop(gpointer data)
+static int eb_yahoo_send_typing_stop(gpointer data)
{
eb_ext_yahoo_typing_notify_data *tcd = data;
eb_local_account * ela = yahoo_find_local_account_by_id(tcd->id);
@@ -1500,7 +1518,7 @@
}
}
-static gboolean eb_yahoo_query_connected(eb_account * ea)
+static int eb_yahoo_query_connected(eb_account * ea)
{
eb_yahoo_account_data *yad = ea->protocol_account_data;
@@ -1648,7 +1666,7 @@
static void eb_yahoo_send_im(eb_local_account * account_from,
eb_account * account_to,
- gchar * message)
+ char * message)
{
eb_yahoo_local_account_data *ylad =
account_from->protocol_local_account_data;
char * encoded = y_str_to_utf8(message);
@@ -1759,7 +1777,7 @@
return NULL;
}
-static gint eb_yahoo_get_current_state(eb_local_account * ela)
+static int eb_yahoo_get_current_state(eb_local_account * ela)
{
eb_yahoo_local_account_data *ylad;
@@ -1770,7 +1788,7 @@
return yahoo_to_eb_state_translation(ylad->status);
}
-static void eb_yahoo_set_current_state(eb_local_account * ela, gint state)
+static void eb_yahoo_set_current_state(eb_local_account * ela, int state)
{
eb_yahoo_local_account_data *ylad;
int yahoo_state = eb_to_yahoo_state_translation[state];
@@ -1823,6 +1841,53 @@
yahoo_set_away(ylad->id, yahoo_state, NULL, 1);
}
+static void eb_yahoo_set_buddy_nick(eb_yahoo_local_account_data *ylad, char *
bud_id, char * nick)
+{
+ struct yab * yab = y_new0(struct yab, 1);
+ char * tmp;
+ int i;
+
+ yab->id = bud_id;
+/* yab->nname = nick; */ /* too many hassles with nicks */
+ yab->fname = strdup(nick);
+
+ /* get rid of leading spaces */
+ for(i=0; yab->fname[i] == ' '; i++)
+ ;
+ if(i)
+ memmove(yab->fname, yab->fname+i, strlen(yab->fname+i));
+
+ for(i = strlen(yab->fname)-1; i>=0 && yab->fname[i]==' '; i--)
+ yab->fname[i]='\0';
+
+ tmp = strchr(yab->fname, ' ');
+ if(tmp)
+ *tmp++='\0';
+
+ yab->lname = tmp;
+ tmp = strchr(yab->lname, ' ');
+ if(tmp)
+ yab->lname=tmp;
+
+ yahoo_add_yab(ylad->id, yab);
+
+ free(yab->fname);
+ free(yab);
+}
+
+static void eb_yahoo_change_user_name(eb_account * account, char * name)
+{
+ eb_local_account * ela;
+ eb_yahoo_local_account_data *ylad;
+
+ if(!(ela = eb_yahoo_find_active_local_account()))
+ return;
+
+ ylad = ela->protocol_local_account_data;
+
+ eb_yahoo_set_buddy_nick(ylad, account->handle, name);
+}
+
static void eb_yahoo_add_user(eb_account * ea)
{
eb_local_account * ela;
@@ -1860,6 +1925,9 @@
if (!strcmp(bud->id, ea->handle)) {
LOG(("buddy %s exists, not adding",
ea->handle));
+ if(!bud->real_name && ea->account_contact &&
ea->account_contact->nick) {
+ eb_yahoo_set_buddy_nick(ylad, bud->id,
ea->account_contact->nick);
+ }
return;
}
}
@@ -1884,6 +1952,8 @@
LOG(("eb_yahoo_del_user: %s", ea->handle));
+ free_yahoo_account(ea->protocol_account_data);
+
if(!(ela = eb_yahoo_find_active_local_account()))
return;
@@ -1952,7 +2022,7 @@
yahoo_get_list(ylad->id);
}
-static void eb_yahoo_unignore_user(eb_account * ea, gchar *new_group)
+static void eb_yahoo_unignore_user(eb_account * ea, char *new_group)
{
eb_local_account *ela;
eb_yahoo_local_account_data *ylad;
@@ -1982,7 +2052,7 @@
}
}
-static void eb_yahoo_change_group(eb_account * ea, gchar *new_group)
+static void eb_yahoo_change_group(eb_account * ea, char *new_group)
{
LList *node;
@@ -2004,7 +2074,7 @@
}
}
-static void eb_yahoo_rename_group(gchar *old_group, gchar *new_group)
+static void eb_yahoo_rename_group(char *old_group, char *new_group)
{
LList *node;
@@ -2025,7 +2095,7 @@
}
}
-static eb_account *eb_yahoo_new_account(gchar * account)
+static eb_account *eb_yahoo_new_account(char * account)
{
eb_account *acct = g_new0(eb_account, 1);
eb_yahoo_account_data *yad = g_new0(eb_yahoo_account_data, 1);
@@ -2060,7 +2130,7 @@
return yahoo_online_xpm;
}
-static gchar *eb_yahoo_get_status_string(eb_account * ea)
+static char *eb_yahoo_get_status_string(eb_account * ea)
{
eb_yahoo_account_data *yad = ea->protocol_account_data;
int i;
@@ -2079,7 +2149,7 @@
return "Unk";
}
-static void eb_yahoo_set_idle(eb_local_account * ela, gint idle)
+static void eb_yahoo_set_idle(eb_local_account * ela, int idle)
{
eb_yahoo_local_account_data *ylad;
@@ -2097,7 +2167,7 @@
}
}
-static void eb_yahoo_set_away(eb_local_account * ela, gchar * message)
+static void eb_yahoo_set_away(eb_local_account * ela, char * message)
{
eb_yahoo_local_account_data *ylad;
@@ -2107,7 +2177,7 @@
eb_set_active_menu_status(ela->status_menu,
EB_DISPLAY_YAHOO_ONLINE);
} else {
/* yeah, this was taken from Meredydd's MSN code */
- gint state = EB_DISPLAY_YAHOO_CUSTOM;
+ int state = EB_DISPLAY_YAHOO_CUSTOM;
if(do_guess_away) {
int pos = 0;
@@ -2183,7 +2253,7 @@
return NULL;
}
-static gboolean eb_yahoo_is_suitable(eb_local_account *ela, eb_account *ea)
+static int eb_yahoo_is_suitable(eb_local_account *ela, eb_account *ea)
{
/* in yahoo you can message anyone */
return TRUE;
@@ -2271,7 +2341,7 @@
int tag;
} eb_yahoo_callback_data;
-static void eb_yahoo_callback(gpointer data, gint source, eb_input_condition
condition)
+static void eb_yahoo_callback(gpointer data, int source, eb_input_condition
condition)
{
eb_yahoo_callback_data *d = data;
int ret=1;
@@ -2527,9 +2597,11 @@
sc->del_user = eb_yahoo_del_user;
sc->ignore_user = eb_yahoo_ignore_user;
sc->unignore_user = eb_yahoo_unignore_user;
+ sc->change_user_name = eb_yahoo_change_user_name;
sc->change_group = eb_yahoo_change_group;
sc->rename_group = eb_yahoo_rename_group;
sc->del_group = NULL;
+ sc->free_account_data = eb_yahoo_free_account_data;
sc->is_suitable = eb_yahoo_is_suitable;
sc->new_account = eb_yahoo_new_account;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.31,1.32,
Philip S Tellis <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm/modules/yahoo2/libyahoo2 libyahoo2.c,1.7,1.8 yahoo2.h,1.5,1.6 yahoo_httplib.c,1.5,1.6
- Next by Date:
[Ayttm-commits] CVS: ayttm/src util.c,1.34,1.35 util.h,1.19,1.20
- Previous by thread:
[Ayttm-commits] CVS: ayttm/modules/yahoo2/libyahoo2 libyahoo2.c,1.7,1.8 yahoo2.h,1.5,1.6 yahoo_httplib.c,1.5,1.6
- Next by thread:
[Ayttm-commits] CVS: ayttm/src util.c,1.34,1.35 util.h,1.19,1.20
- Index(es):