[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/modules/aim-toc aim-toc.c,1.19,1.20
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/modules/aim-toc aim-toc.c,1.19,1.20 |
Date: |
Thu, 30 Jan 2003 07:15:56 -0500 |
Update of /cvsroot/ayttm/ayttm/modules/aim-toc
In directory subversions:/tmp/cvs-serv6568/modules/aim-toc
Modified Files:
aim-toc.c
Log Message:
- modules/aim-toc
implement add_group, del_group, rename_group
fix login-related logic bugs
Index: aim-toc.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/aim-toc/aim-toc.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- aim-toc.c 30 Jan 2003 09:39:02 -0000 1.19
+++ aim-toc.c 30 Jan 2003 12:15:40 -0000 1.20
@@ -403,6 +403,8 @@
if(ea)
{
aad = ea->protocol_account_data;
+ if (!l_list_find(aim_buddies, ea->handle))
+ aim_buddies = l_list_append(aim_buddies, ea->handle);
}
else
{
@@ -490,6 +492,13 @@
aim_info_update(sender);
}
+static void eb_aim_new_group(char * group)
+{
+ if(!find_grouplist_by_name(group)) {
+ add_group(group);
+ }
+}
+
static void eb_aim_new_user(char * group, char * handle)
{
eb_account * ea = find_account_by_handle( handle,
SERVICE_INFO.protocol_id );
@@ -699,7 +708,7 @@
{
struct eb_aim_local_account_data * alad;
- account->connected = 1;
+ account->connecting = 1;
alad = (struct eb_aim_local_account_data
*)account->protocol_local_account_data;
@@ -710,13 +719,11 @@
if(!alad->conn)
{
g_warning("FAILED TO CONNECT TO AIM SERVER!!!!!!!!!!!!");
- account->connected = 0;
return;
}
if(alad->conn->fd == -1 )
{
g_warning("eb_aim UNKNOWN CONNECTION PROBLEM");
- account->connected = 0;
return;
}
eb_debug(DBG_TOC, "eb_aim_login %d %d\n", alad->conn->fd,
alad->conn->seq_num );
@@ -733,6 +740,9 @@
eb_set_active_menu_status(account->status_menu, AIM_ONLINE);
is_setting_state = 0;
+ account->connecting = 0;
+ account->connected = 1;
+
toc_add_buddy(alad->conn,account->handle,
"Unknown");
aim_buddies = l_list_append(aim_buddies, account->handle);
@@ -919,16 +929,14 @@
switch(state) {
case AIM_ONLINE:
- if (account->connected == 0) {
+ if (account->connected == 0 && account->connecting == 0) {
eb_aim_login(account);
- account->connected = 1;
}
toc_set_away(alad->conn, NULL);
break;
case AIM_AWAY:
- if (account->connected == 0) {
+ if (account->connected == 0 && account->connecting == 0) {
eb_aim_login(account);
- account->connected = 1;
}
if (is_away)
toc_set_away(alad->conn, get_away_message());
@@ -938,7 +946,6 @@
case AIM_OFFLINE:
if (account->connected == 1) {
eb_aim_logout(account);
- account->connected = 0;
}
break;
}
@@ -1021,7 +1028,7 @@
toc_set_idle( alad->conn, idle );
}
-static void eb_aim_change_group(eb_account * ea, char *new_group)
+static void eb_aim_real_change_group(eb_account * ea, char *old_group, char
*new_group)
{
char str[2048];
struct eb_aim_local_account_data * alad;
@@ -1038,10 +1045,62 @@
if( ela && ela->connected && ela->service_id == ea->service_id)
{
alad = ela->protocol_local_account_data;
- toc_remove_buddy(alad->conn, ea->handle,
ea->account_contact->group->name );
+ toc_remove_buddy(alad->conn, ea->handle, old_group);
toc_add_buddy(alad->conn, ea->handle, new_group);
}
-
+ }
+}
+
+static void eb_aim_change_group(eb_account * ea, char *new_group)
+{
+ eb_aim_real_change_group(ea, ea->account_contact->group->name,
new_group);
+}
+
+static void eb_aim_del_group(char *group)
+{
+ struct eb_aim_local_account_data * alad;
+ LList * node;
+
+ for( node = accounts; node; node=node->next )
+ {
+ eb_local_account * ela = node->data;
+ if( ela && ela->connected && ela->service_id ==
SERVICE_INFO.protocol_id)
+ {
+ alad = ela->protocol_local_account_data;
+ toc_remove_group(alad->conn, group);
+ }
+ }
+}
+
+static void eb_aim_add_group(char *group)
+{
+ struct eb_aim_local_account_data * alad;
+ LList * node;
+
+ for( node = accounts; node; node=node->next )
+ {
+ eb_local_account * ela = node->data;
+ if( ela && ela->connected && ela->service_id ==
SERVICE_INFO.protocol_id)
+ {
+ alad = ela->protocol_local_account_data;
+ toc_add_group(alad->conn, group);
+ }
+ }
+}
+
+static void eb_aim_rename_group(char *old_group, char *new_group)
+{
+ LList *l;
+
+ for(l = aim_buddies; l; l=l->next)
+ {
+ eb_account *ea = find_account_by_handle(l->data,
SERVICE_INFO.protocol_id);
+ if (ea)
+ eb_debug(DBG_TOC, "checking if we should move %s from
%s\n",ea->handle, ea->account_contact->group->name);
+ if (ea && !strcmp(ea->account_contact->group->name, new_group))
{
+ eb_debug(DBG_TOC, "Moving %s from %s to
%s\n",ea->handle, old_group, new_group);
+ eb_aim_real_change_group(ea, old_group, new_group);
+ }
}
}
@@ -1125,6 +1184,7 @@
toc_file_offer = eb_aim_file_offer;
toc_user_info = eb_aim_user_info;
toc_new_user = eb_aim_new_user;
+ toc_new_group = eb_aim_new_group;
sc = g_new0( struct service_callbacks, 1 );
sc->query_connected = eb_aim_query_connected;
@@ -1162,5 +1222,8 @@
sc->get_smileys = eb_default_smileys;
sc->change_group = eb_aim_change_group;
+ sc->add_group = eb_aim_add_group;
+ sc->del_group = eb_aim_del_group;
+ sc->rename_group = eb_aim_rename_group;
return sc;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/modules/aim-toc aim-toc.c,1.19,1.20,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.56,1.57
- Next by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.257,1.258 configure.in,1.253,1.254
- Previous by thread:
[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.56,1.57
- Next by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.257,1.258 configure.in,1.253,1.254
- Index(es):