[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src service.c,1.13,1.14 service.h,1.16,1.17 u
From: |
Philip S Tellis <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src service.c,1.13,1.14 service.h,1.16,1.17 util.c,1.32,1.33 util.h,1.17,1.18 |
Date: |
Wed, 29 Jan 2003 08:32:22 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv10528/src
Modified Files:
service.c service.h util.c util.h
Log Message:
major cleanups to utility stuff
Index: service.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/service.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- service.c 29 Jan 2003 09:22:17 -0000 1.13
+++ service.c 29 Jan 2003 13:32:19 -0000 1.14
@@ -38,10 +38,12 @@
#include "service.h"
#include "globals.h"
#include "account.h"
+#include "chat_window.h"
#include "dialog.h"
#include "util.h"
#include "nomodule.h"
#include "plugin_api.h"
+#include "value_pair.h"
#ifdef HAVE_MIT_SAVER_EXTENSION
#include <X11/extensions/scrnsaver.h>
@@ -58,6 +60,44 @@
/* Following chunk will be moved to a 'real' code file */
/* FIXME: Should be a dynamic array */
struct service eb_services[255];
+
+/* Called when a service module changes */
+static void refresh_service_contacts(int type)
+{
+ LList *l1, *l2, *l3;
+ LList * config=NULL;
+ struct contact *con=NULL;
+
+ eb_debug(DBG_CORE, ">Refreshing contacts for %i\n", type);
+ for(l1 = groups; l1; l1=l1->next ) {
+ for(l2 = ((grouplist*)l1->data)->members; l2; l2=l2->next ) {
+ con=l2->data;
+ if(con->chatwindow && con->chatwindow->preferred &&
con->chatwindow->preferred->service_id==type) {
+ eb_debug(DBG_MOD, "Setting the preferred
service to NULL for %s\n", con->nick);
+ con->chatwindow->preferred=NULL;
+ }
+ for(l3 = con->accounts; l3; l3=l3->next) {
+ eb_account * account = l3->data;
+ if(account->service_id == type) {
+ eb_debug(DBG_CORE, "Refreshing %s -
%i\n", account->handle, type);
+ config = value_pair_add(NULL, "NAME",
account->handle);
+
if(RUN_SERVICE(account)->free_account_data)
+
RUN_SERVICE(account)->free_account_data(account);
+ g_free(account);
+ account =
eb_services[type].sc->read_account_config(config, con);
+ /* Is this a nomodule account? Make it
the right service number */
+ if(account->service_id==-1)
+ account->service_id=type;
+ value_pair_free(config);
+ config=NULL;
+ l3->data=account;
+ }
+ }
+ }
+ }
+ eb_debug(DBG_CORE, "<Leaving\n");
+ return;
+}
/* Add a new service, or replace an existing one */
int add_service(struct service *Service_Info)
Index: service.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/service.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- service.h 29 Jan 2003 12:30:15 -0000 1.16
+++ service.h 29 Jan 2003 13:32:19 -0000 1.17
@@ -84,7 +84,10 @@
/*Informs the service of an account that it needs to manage*/
void (*add_user)(eb_account * account);
- /*Notifies the service that it doesn't need to track an account*/
+ /*
+ * Notifies the service that it doesn't need to track an account
+ * del_user should free any protocol_account_data it has created
+ */
void (*del_user)(eb_account * account);
/*Notifies the service that the user needs to be ignored*/
Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- util.c 29 Jan 2003 10:41:43 -0000 1.32
+++ util.c 29 Jan 2003 13:32:19 -0000 1.33
@@ -434,7 +434,7 @@
remote - the account to find a local account for
online - whether the local account needs to be online
*/
-eb_local_account * find_local_account_for_remote( eb_account *remote, gboolean
online )
+eb_local_account * find_local_account_for_remote( eb_account *remote, int
online )
{
static LList * node = NULL;
static eb_account *last_remote=NULL;
@@ -450,16 +450,13 @@
}
for( ; node; node = node->next ) {
- eb_local_account * ela = (eb_local_account *)(node->data);
+ eb_local_account * ela = node->data;
if (remote->service_id == ela->service_id) {
- if (eb_services[ela->service_id].sc->is_suitable !=
NULL) {
- if
(eb_services[ela->service_id].sc->is_suitable(ela, remote) == TRUE
- && (!online || ela->connected))
- return (ela);
- }
- else if (!online || ela->connected)
- return (ela);
+ if ( (!online || ela->connected ) &&
+ ( !RUN_SERVICE(ela)->is_suitable ||
+ RUN_SERVICE(ela)->is_suitable(ela,
remote) ) )
+ return ela;
}
}
@@ -467,29 +464,29 @@
return NULL;
}
-eb_local_account * find_suitable_local_account( eb_local_account * first,
- int second )
+eb_local_account * find_suitable_local_account( eb_local_account * first, int
second )
{
LList * node;
LList * states;
- /*The last state in the list of states will be the OFFLINE state*
- *The first state in the list will be the ONLINE states
*
- *The rest of the states are the various AWAY states
*/
+ /* The last state in the list of states will be the OFFLINE state
+ * The first state in the list will be the ONLINE states
+ * The rest of the states are the various AWAY states
+ */
states = eb_services[second].sc->get_states();
l_list_free(states);
- if( first && first->connected )
+ if( first && ( first->connected || first->connecting) )
return first;
/*dang, we are out of luck with our first choice, do we have something
else that uses the same service? */
for( node = accounts; node; node = node->next ) {
- eb_local_account * ela = (eb_local_account *)(node->data);
- eb_debug(DBG_CORE, "%s %s\n",
eb_services[ela->service_id].name, ela->handle);
+ eb_local_account * ela = node->data;
+ eb_debug(DBG_CORE, "%s %s\n",
get_service_name(ela->service_id), ela->handle);
if( ela->service_id == second && (ela->connected ||
ela->connecting))
return ela;
@@ -502,15 +499,13 @@
return NULL;
}
-/* if contact can offline message, return the account,
- otherwise, return null
-*/
+/* if contact can offline message, return the account, otherwise, return null
*/
eb_account * can_offline_message( struct contact * con )
{
LList * node;
for(node = con->accounts; node; node=node->next) {
- eb_account * ea = (eb_account*)node->data;
+ eb_account * ea = node->data;
if( eb_services[ea->service_id].offline_messaging )
return ea;
@@ -518,19 +513,19 @@
return NULL;
}
-eb_account * find_suitable_remote_account( eb_account * first,
- struct contact * rest )
+eb_account * find_suitable_remote_account( eb_account * first, struct contact
* rest )
{
LList * node;
eb_account * possibility = NULL;
- if( first && eb_services[first->service_id].sc->query_connected(first) )
+ if( first && (eb_services[first->service_id].offline_messaging ||
+ RUN_SERVICE(first)->query_connected(first)) )
return first;
for(node = rest->accounts; node; node=node->next) {
- eb_account * ea = (eb_account*)node->data;
+ eb_account * ea = node->data;
- if( eb_services[ea->service_id].sc->query_connected(ea) ) {
+ if( RUN_SERVICE(ea)->query_connected(ea) ) {
if(ea->service_id == rest->default_chatb )
return ea;
else
@@ -540,8 +535,7 @@
return possibility;
}
-eb_account * find_suitable_file_transfer_account( eb_account * first,
- struct contact * rest )
+eb_account * find_suitable_file_transfer_account( eb_account * first, struct
contact * rest )
{
LList * node;
eb_account * possibility = NULL;
@@ -549,14 +543,14 @@
if ( first == NULL )
return NULL;
- if( first && eb_services[first->service_id].sc->query_connected(first)
+ if( first && RUN_SERVICE(first)->query_connected(first)
&& eb_services[first->service_id].file_transfer )
return first;
for(node = rest->accounts; node; node=node->next) {
- eb_account * ea = (eb_account*)node->data;
+ eb_account * ea = node->data;
- if( eb_services[ea->service_id].sc->query_connected(ea)
+ if( RUN_SERVICE(ea)->query_connected(ea)
&& eb_services[first->service_id].file_transfer
) {
if(ea->service_id == rest->default_chatb )
return ea;
@@ -585,7 +579,7 @@
LList * node = chat_rooms;
for( node= chat_rooms; node && node->data; node=node->next) {
eb_chat_room * ecr = node->data;
- if(!strcmp(name, ecr->room_name) &&
(ecr->chat_room_account->service_id == service_id) )
+ if((ecr->chat_room_account->service_id == service_id) &&
!strcmp(name, ecr->room_name) )
return ecr;
}
return NULL;
@@ -599,17 +593,14 @@
for (node = chat_rooms; node && node->data; node = node->next) {
eb_chat_room *ecr = node->data;
- if (ecr && remote->service_id == ecr->service_id) {
+ if (remote->service_id == ecr->service_id) {
LList *others = NULL;
- int found = FALSE;
- for (others = ecr->fellows;
- others && others->data && !found;
- others = others->next) {
+ for (others = ecr->fellows; others && others->data;
others = others->next) {
eb_chat_room_buddy *ecrb = others->data;
if(!strcmp(remote->handle, ecrb->handle)) {
- found = TRUE;
result = l_list_append(result, ecr);
eb_debug(DBG_CORE, "Found %s in
%s\n",remote->handle, ecr->room_name);
+ break;
}
}
}
@@ -624,36 +615,32 @@
if (name == NULL)
return NULL;
- for(l1 = groups; l1; l1=l1->next ) {
- if(!g_strncasecmp(((grouplist *)l1->data)->name, name,
strlen(name)+1))
- return (grouplist*)l1->data;
- }
+ for(l1 = groups; l1; l1=l1->next )
+ if(!strcasecmp(((grouplist *)l1->data)->name, name))
+ return l1->data;
+
return NULL;
}
grouplist * find_grouplist_by_nick(char * nick)
{
- LList * l1;
- LList * l2;
+ LList * l1, *l2;
if (nick == NULL)
return NULL;
- for(l1 = groups; l1; l1=l1->next ) {
- for(l2 = ((grouplist*)l1->data)->members; l2; l2=l2->next ) {
+ for(l1 = groups; l1; l1=l1->next )
+ for(l2 = ((grouplist*)l1->data)->members; l2; l2=l2->next )
if(!strcmp(((struct contact*)l2->data)->nick, nick))
- return (grouplist*)l1->data;
- }
- }
+ return l1->data;
+
return NULL;
}
struct contact * find_contact_by_handle( char * handle )
{
- LList * l1;
- LList * l2;
- LList * l3;
+ LList *l1, *l2, *l3;
if (handle == NULL)
return NULL;
@@ -672,15 +659,14 @@
struct contact * find_contact_by_nick( char * nick )
{
- LList * l1;
- LList * l2;
+ LList *l1, *l2;
if (nick == NULL)
- return NULL;
+ return NULL;
for(l1 = groups; l1; l1=l1->next ) {
for(l2 = ((grouplist*)l1->data)->members; l2; l2=l2->next ) {
- if(!g_strncasecmp(((struct contact*)l2->data)->nick,
nick, strlen(nick)+1))
+ if(!strcasecmp(((struct contact*)l2->data)->nick, nick))
return (struct contact*)l2->data;
}
}
@@ -695,7 +681,7 @@
return NULL;
for(l = gl->members; l; l=l->next ) {
- if(!g_strncasecmp(((struct contact*)l->data)->nick, nick,
strlen(nick)+1))
+ if(!strcasecmp(((struct contact*)l->data)->nick, nick))
return (struct contact*)l->data;
}
@@ -726,63 +712,20 @@
return buf;
}
-void refresh_service_contacts(int type)
-{
- LList * l1;
- LList * l2;
- LList * l3;
- LList * config=NULL;
- struct contact *con=NULL;
-
- eb_debug(DBG_CORE, ">Refreshing contacts for %i\n", type);
- for(l1 = groups; l1; l1=l1->next ) {
- for(l2 = ((grouplist*)l1->data)->members; l2; l2=l2->next ) {
- con=(struct contact *)l2->data;
- if(con->chatwindow && con->chatwindow->preferred &&
(con->chatwindow->preferred->service_id==type)) {
- eb_debug(DBG_MOD, "Setting the preferred
service to NULL for %s\n", con->nick);
- con->chatwindow->preferred=NULL;
- }
- for(l3 = con->accounts; l3; l3=l3->next) {
- eb_account * account = (eb_account*)l3->data;
- if(account->service_id == type) {
- eb_debug(DBG_CORE, "Refreshing %s -
%i\n", account->handle, type);
- config = value_pair_add(NULL, "NAME",
account->handle);
- g_free(account->protocol_account_data);
- g_free(account);
- account =
eb_services[type].sc->read_account_config(config, (struct contact*)l2->data);
- /* Is this a nomodule account? Make it
the right service number */
- if(account->service_id==-1)
- account->service_id=type;
- value_pair_free(config);
- config=NULL;
- l3->data=account;
- }
- }
- }
- }
- eb_debug(DBG_CORE, "<Leaving\n");
- return;
-}
-
eb_account * find_account_by_handle( char * handle, int type )
{
- LList * l1;
- LList * l2;
- LList * l3;
+ LList *l1, *l2, *l3;
if (handle == NULL)
return NULL;
+
for(l1 = groups; l1; l1=l1->next ) {
for(l2 = ((grouplist*)l1->data)->members; l2; l2=l2->next ) {
for(l3 = ((struct contact*)l2->data)->accounts; l3;
l3=l3->next) {
- eb_account * account = (eb_account*)l3->data;
- char string1[255];
- char string2[255];
- strcpy(string1, aim_normalize(account->handle));
- strcpy(string2, aim_normalize(handle));
- if(!g_strncasecmp(string1,
string2,strlen(string1)+1)
- && account->service_id == type )
- return account;
+ eb_account * ea = l3->data;
+
+ if(ea->service_id == type &&
!strcasecmp(handle, ea->handle))
+ return ea;
}
}
}
@@ -798,7 +741,7 @@
for(l1 = accounts; l1; l1=l1->next ) {
eb_local_account * account = (eb_local_account*)l1->data;
- if(account->service_id == type &&
!g_strncasecmp(account->handle, handle, strlen(handle)+1))
+ if(account->service_id == type && !strcasecmp(account->handle,
handle))
return account;
}
return NULL;
@@ -873,6 +816,7 @@
int remove_account( eb_account * a )
{
struct contact * c = a->account_contact;
+
if (!find_suitable_local_account(NULL, a->service_id))
contact_mgmt_queue_add(a, MGMT_DEL, NULL);
@@ -884,7 +828,7 @@
RUN_SERVICE(a)->del_user(a);
g_free(a);
- if (!l_list_length(c->accounts)) {
+ if (l_list_length(c->accounts) == 0) {
remove_contact(c);
return 0; /* so if coming from remove_contact
don't try again to remove_contact_line()
@@ -932,23 +876,24 @@
void add_group( char * name )
{
LList *node = NULL;
- grouplist g, *eg;
- strncpy(g.name, name,255);
- g.members = NULL;
- g.list_item = NULL;
+ grouplist *eg = calloc(1, sizeof(grouplist));
+ strncpy(eg->name, name, sizeof(eg->name));
- groups = l_list_append( groups, eg = g_memdup(&g, sizeof(grouplist)));
+ groups = l_list_append( groups, eg );
add_group_line(eg);
for( node = accounts; node; node = node->next ) {
- eb_local_account * ela = (eb_local_account *)(node->data);
- if (ela->connected && RUN_SERVICE(ela)->add_group) {
- eb_debug(DBG_CORE, "adding group %s in %s\n",
- name, get_service_name(ela->service_id));
- RUN_SERVICE(ela)->add_group(name);
- }
+ eb_local_account * ela = node->data;
+ if (RUN_SERVICE(ela)->add_group)
+ if (ela->connected) {
+ eb_debug(DBG_CORE, "adding group %s in %s\n",
+ name,
get_service_name(ela->service_id));
+ RUN_SERVICE(ela)->add_group(name);
+ } else {
+ /* TODO: Add to queue */
+ }
}
- update_contact_list ();
+ update_contact_list();
write_contact_list();
}
@@ -961,67 +906,76 @@
strcpy (current_group->name, new_name);
gtk_label_set_text(GTK_LABEL(current_group->label),
current_group->name);
- update_contact_list ();
+ update_contact_list();
write_contact_list();
for( node = accounts; node; node = node->next ) {
- eb_local_account * ela = (eb_local_account *)(node->data);
- if (ela->connected && RUN_SERVICE(ela)->rename_group) {
- eb_debug(DBG_CORE, "renaming group %s to %s in %s\n",
+ eb_local_account * ela = node->data;
+ if (RUN_SERVICE(ela)->rename_group)
+ if (ela->connected) {
+ eb_debug(DBG_CORE, "renaming group %s to %s in
%s\n",
oldname, new_name,
get_service_name(ela->service_id));
- RUN_SERVICE(ela)->rename_group(oldname, new_name);
- }
+ RUN_SERVICE(ela)->rename_group(oldname,
new_name);
+ } else {
+ /* TODO: Add to queue */
+ }
}
}
+/* compares two contact names */
static int contact_cmp(const void * a, const void * b)
{
const struct contact *ca=a, *cb=b;
return strcasecmp(ca->nick, cb->nick);
}
-struct contact * add_new_contact( char * group, char * con, int type )
+struct relocate_account_data {
+ eb_account * account;
+ struct contact * contact;
+};
+
+static void move_account_yn(void * data, int result)
{
- grouplist * g = find_grouplist_by_name( group);
- struct contact * c = g_new0( struct contact, 1);
- c->online = 0;
- if (con != NULL)
- strncpy(c->nick, con, 255);
+ struct relocate_account_data * rad = data;
- c->default_chatb = c->default_filetransb = type;
+ if(result)
+ move_account(rad->contact, rad->account);
- if(g) {
- g->members = l_list_insert_sorted(g->members, c, contact_cmp);
- c->group = g;
- }
- return c;
+ free(rad);
}
-static void add_account_verbose( char * contact, eb_account * account,
gboolean verbosity )
+static void add_account_verbose( char * contact, eb_account * account, int
verbosity )
{
struct contact * c = find_contact_by_nick( contact );
eb_account * ea = find_account_by_handle(account->handle,
account->service_id);
if (!find_suitable_local_account(NULL, account->service_id)) {
contact_mgmt_queue_add(account, MGMT_ADD,
c?c->group->name:_("Unknown"));
}
- if(ea) {
- /* shouldn't it be ea->account_contact->group->name ? */
- if(!strcasecmp(ea->account_contact->nick, _("Unknown"))) {
- struct contact * c2 = ea->account_contact;
- remove_account(ea);
- if(l_list_length(c2->accounts) == 0)
- remove_contact(c2);
+ if(ea) {
+ if(!strcasecmp(ea->account_contact->group->name, _("Unknown")))
{
+ move_account(c, ea);
} else {
char buff[2048];
- g_snprintf(buff, 2048, _("The account already exists on
your\ncontact list at the following location\nGroup: %s\nContact: %s\nPlease
delete this account before\nadding it elsewhere."),
ea->account_contact->group->name, ea->account_contact->nick );
-
- if( c && l_list_length(c->accounts) == 0)
+ snprintf(buff, sizeof(buff),
+ _("The account already exists on your\n"
+ "contact list at the following
location\n"
+ "Group: %s\n"
+ "Contact: %s\n"
+ "Should I move it?"),
+ ea->account_contact->group->name,
ea->account_contact->nick );
+
+ /* remove this contact if it was newly created */
+ if(verbosity) {
+ struct relocate_account_data * rad =
+ calloc(1, sizeof(struct
relocate_account_data));
+ rad->account = account;
+ rad->contact = c;
+ eb_do_dialog(buff, _("Error: account exists"),
move_account_yn, rad);
+ } else if( c && l_list_length(c->accounts) == 0)
remove_contact(c);
- if(verbosity)
- do_error_dialog(buff, _("Error: account
exists"));
- return;
- }
+ }
+ return;
}
if (c) {
c->accounts = l_list_append( c->accounts, account );
@@ -1033,7 +987,7 @@
RUN_SERVICE(account)->ignore_user(account);
}
else
- add_unknown(account);
+ add_unknown_with_name(account, contact);
}
void add_account_silent ( char * contact, eb_account * account )
@@ -1061,39 +1015,38 @@
user->group = grp;
}
-void add_unknown( eb_account * ea )
+struct contact * add_new_contact( char * group, char * con, int type )
+{
+ struct contact * c = calloc(1, sizeof(struct contact));
+ if (con != NULL)
+ strncpy(c->nick, con, sizeof(c->nick));
+
+ c->default_chatb = c->default_filetransb = type;
+
+ add_contact(group, c);
+
+ return c;
+}
+
+void add_unknown_with_name( eb_account * ea, char * name )
{
- struct contact * con = g_new0(struct contact, 1);
+ struct contact * con = add_new_contact(_("Unknown"),
+ (name && strlen(name))?name:ea->handle, ea->service_id);
- strncpy(con->nick, ea->handle, 255);
con->accounts = l_list_append( con->accounts, ea );
- con->default_chatb = ea->service_id;
- con->default_filetransb = ea->service_id;
ea->account_contact = con;
- add_contact(_("Unknown"), con);
- ea->icon_handler = -1;
- ea->status_handler = -1;
- RUN_SERVICE(ea)->add_user(ea);
+ ea->icon_handler = ea->status_handler = -1;
+ if(find_suitable_local_account(NULL, ea->service_id))
+ RUN_SERVICE(ea)->add_user(ea);
+ else {
+ /* TODO: Add to queue */
+ }
write_contact_list();
}
-void add_unknown_with_name( eb_account * ea, char * name )
+void add_unknown( eb_account * ea )
{
- add_unknown(ea);
-
- if (name && strlen(name)) {
- strncpy(ea->account_contact->nick, name, 255);
- if (RUN_SERVICE(ea)->change_user_name) {
- if (!find_suitable_local_account(NULL, ea->service_id))
- contact_mgmt_queue_add(ea, MGMT_REN, name);
- else
- RUN_SERVICE(ea)->change_user_name(ea, name);
- }
- }
- else
- strncpy(ea->account_contact->nick, ea->handle, 255);
-
- write_contact_list();
+ add_unknown_with_name(ea, NULL);
}
static void handle_group_change(eb_account *ea, char *og, char *ng)
@@ -1148,8 +1101,10 @@
con->accounts = l_list_append(con->accounts, ea);
ea->account_contact = con;
- if(ea->online)
+ if(ea->online) {
con->online++;
+ add_contact_line(con);
+ }
add_contact_and_accounts(con);
}
@@ -1180,8 +1135,7 @@
con = find_contact_by_nick(c->nick);
if(con) {
rename_nick_log(group, c->nick, group, con->nick);
- l = c->accounts;
- while(l) {
+ for(l=c->accounts; l; l=l->next) {
eb_account *ea = l->data;
ea->account_contact = con;
@@ -1192,18 +1146,63 @@
else
RUN_SERVICE(ea)->change_user_name(ea,
con->nick);
}
-
- l = l->next;
}
l_list_free(c->accounts);
add_contact_and_accounts(con);
+ add_contact_line(con);
} else {
g->members = l_list_insert_sorted(g->members, c, contact_cmp);
c->group = g;
add_contact_and_accounts(c);
+ add_contact_line(c);
}
}
+void rename_contact( struct contact * c, char *newname)
+{
+ LList *l = NULL;
+ struct contact *con;
+
+ eb_debug(DBG_CORE,"Renaming %s to %s\n",c->nick, newname);
+ con = find_contact_in_group_by_nick(newname, c->group);
+ if(con) {
+ eb_debug(DBG_CORE,"found existing contact\n");
+ rename_nick_log(c->group->name, c->nick, c->group->name,
con->nick);
+ l = c->accounts;
+ while(l) {
+ eb_account *ea = l->data;
+ move_account(con,ea);
+ l = c->accounts;
+ }
+ update_contact_list ();
+ write_contact_list();
+
+ } else {
+ eb_debug(DBG_CORE,"no existing contact\n");
+
+ rename_nick_log(c->group->name, c->nick, c->group->name,
newname);
+ strncpy(c->nick, newname, 254);
+ c->nick[254] = '\0';
+ if (c->label)
+ gtk_label_set_text(GTK_LABEL(c->label), newname);
+ l = c->accounts;
+ while(l) {
+ eb_account *ea = l->data;
+
+ if (RUN_SERVICE(ea)->change_user_name) {
+ if (!find_suitable_local_account(NULL,
ea->service_id))
+ contact_mgmt_queue_add(ea, MGMT_REN,
newname);
+ else
+ RUN_SERVICE(ea)->change_user_name(ea,
newname);
+ }
+
+ l = l->next;
+ }
+ }
+ update_contact_list ();
+ write_contact_list();
+}
+
typedef struct _invite_request
{
eb_local_account * ela;
@@ -1237,9 +1236,6 @@
do_dialog( message, _("Chat Invite"), process_invite, invite );
g_free(message);
}
-
-
-
void make_safe_filename(char *buff, char *name, char *group) {
@@ -1365,51 +1361,6 @@
mid->callback(ecd);
}
-void rename_contact( struct contact * c, char *newname)
-{
- LList *l = NULL;
- struct contact *con;
-
- eb_debug(DBG_CORE,"Renaming %s to %s\n",c->nick, newname);
- con = find_contact_in_group_by_nick(newname, c->group);
- if(con) {
- eb_debug(DBG_CORE,"found existing contact\n");
- rename_nick_log(c->group->name, c->nick, c->group->name,
con->nick);
- l = c->accounts;
- while(l) {
- eb_account *ea = l->data;
- move_account(con,ea);
- l = c->accounts;
- }
- update_contact_list ();
- write_contact_list();
-
- } else {
- eb_debug(DBG_CORE,"no existing contact\n");
-
- rename_nick_log(c->group->name, c->nick, c->group->name,
newname);
- strncpy(c->nick, newname, 254);
- c->nick[254] = '\0';
- if (c->label)
- gtk_label_set_text(GTK_LABEL(c->label), newname);
- l = c->accounts;
- while(l) {
- eb_account *ea = l->data;
-
- if (RUN_SERVICE(ea)->change_user_name) {
- if (!find_suitable_local_account(NULL,
ea->service_id))
- contact_mgmt_queue_add(ea, MGMT_REN,
newname);
- else
- RUN_SERVICE(ea)->change_user_name(ea,
newname);
- }
-
- l = l->next;
- }
- }
- update_contact_list ();
- write_contact_list();
-}
-
/*
* This function just gets a linked list of groups, this is handy
* because we can then use it to populate the groups combo widget
@@ -1487,7 +1438,7 @@
char *oldgroup = strtok(NULL,"\t");
char *newgroup = strtok(NULL,"\n");
eb_account *ea = NULL;
- gboolean ea_recreated = TRUE;
+ int ea_recreated = TRUE;
ea = find_account_by_handle(handle,
ela->service_id);
Index: util.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- util.h 29 Jan 2003 09:52:40 -0000 1.17
+++ util.h 29 Jan 2003 13:32:19 -0000 1.18
@@ -104,7 +104,6 @@
struct contact * find_contact_by_handle( char * handle );
struct contact * find_contact_by_nick( char * nick);
struct contact * find_contact_in_group_by_nick( char * nick, grouplist *gl );
-void refresh_service_contacts(int type);
eb_account * find_account_by_handle( char * handle, int type );
eb_local_account * find_local_account_by_handle( char * handle, int type );
void strip_html(char * text);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src service.c,1.13,1.14 service.h,1.16,1.17 util.c,1.32,1.33 util.h,1.17,1.18,
Philip S Tellis <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm configure.in,1.238,1.239 ChangeLog,1.242,1.243
- Next by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.243,1.244 configure.in,1.239,1.240
- Previous by thread:
[Ayttm-commits] CVS: ayttm configure.in,1.238,1.239 ChangeLog,1.242,1.243
- Next by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.243,1.244 configure.in,1.239,1.240
- Index(es):