aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-03-30 22:40:45 -0700
committerWilmer van der Gaast <wilmer@gaast.net>2007-03-30 22:40:45 -0700
commit0da65d5fb37691ed4d31f7ab4058732f1440db6b (patch)
treea4904e65af761a4503bbc8d4a117d9a0a0ed42f8
parentfa29d09342c79b886efacee4cfc3078be5f5a722 (diff)
s/gaim_connection/im_connection/ and some other minor API changes. The rest
will come tomorrow. It compiles, I'll leave the real testing up to someone else. ;-)
-rw-r--r--account.c16
-rw-r--r--account.h2
-rw-r--r--irc.c42
-rw-r--r--irc_commands.c36
-rw-r--r--protocols/jabber/io.c154
-rw-r--r--protocols/jabber/iq.c136
-rw-r--r--protocols/jabber/jabber.c92
-rw-r--r--protocols/jabber/jabber.h46
-rw-r--r--protocols/jabber/jabber_util.c54
-rw-r--r--protocols/jabber/message.c12
-rw-r--r--protocols/jabber/presence.c40
-rw-r--r--protocols/jabber/sasl.c48
-rw-r--r--protocols/msn/msn.c144
-rw-r--r--protocols/msn/msn.h26
-rw-r--r--protocols/msn/msn_util.c40
-rw-r--r--protocols/msn/ns.c224
-rw-r--r--protocols/msn/sb.c68
-rw-r--r--protocols/nogaim.c428
-rw-r--r--protocols/nogaim.h148
-rw-r--r--protocols/oscar/aim.h2
-rw-r--r--protocols/oscar/im.c4
-rw-r--r--protocols/oscar/oscar.c464
-rw-r--r--protocols/oscar/service.c4
-rw-r--r--protocols/yahoo/yahoo.c215
-rw-r--r--query.c18
-rw-r--r--query.h6
-rw-r--r--root_commands.c120
-rw-r--r--user.c12
-rw-r--r--user.h4
29 files changed, 1306 insertions, 1299 deletions
diff --git a/account.c b/account.c
index 95aa9b7c..03d05586 100644
--- a/account.c
+++ b/account.c
@@ -64,8 +64,8 @@ account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )
/* This function adds some more settings (and might want to do more
things that have to be done now, although I can't think of anything. */
- if( prpl->acc_init )
- prpl->acc_init( a );
+ if( prpl->init )
+ prpl->init( a );
return( a );
}
@@ -75,7 +75,7 @@ char *set_eval_account( set_t *set, char *value )
account_t *acc = set->data;
/* Double-check: We refuse to edit on-line accounts. */
- if( set->flags & ACC_SET_OFFLINE_ONLY && acc->gc )
+ if( set->flags & ACC_SET_OFFLINE_ONLY && acc->ic )
return NULL;
if( strcmp( set->key, "username" ) == 0 )
@@ -179,7 +179,7 @@ void account_del( irc_t *irc, account_t *acc )
for( a = irc->accounts; a; a = (l=a)->next )
if( a == acc )
{
- if( a->gc ) return; /* Caller should have checked, accounts still in use can't be deleted. */
+ if( a->ic ) return; /* Caller should have checked, accounts still in use can't be deleted. */
if( l )
{
@@ -208,7 +208,7 @@ void account_del( irc_t *irc, account_t *acc )
void account_on( irc_t *irc, account_t *a )
{
- if( a->gc )
+ if( a->ic )
{
/* Trying to enable an already-enabled account */
return;
@@ -222,9 +222,9 @@ void account_on( irc_t *irc, account_t *a )
void account_off( irc_t *irc, account_t *a )
{
- a->gc->wants_to_die = TRUE;
- signoff( a->gc );
- a->gc = NULL;
+ a->ic->wants_to_die = TRUE;
+ signoff( a->ic );
+ a->ic = NULL;
if( a->reconnect )
{
/* Shouldn't happen */
diff --git a/account.h b/account.h
index 83f47a89..a81ca928 100644
--- a/account.h
+++ b/account.h
@@ -40,7 +40,7 @@ typedef struct account
GHashTable *nicks;
struct irc *irc;
- struct gaim_connection *gc;
+ struct im_connection *ic;
struct account *next;
} account_t;
diff --git a/irc.c b/irc.c
index 5551f559..b1cae1d9 100644
--- a/irc.c
+++ b/irc.c
@@ -229,9 +229,9 @@ void irc_free(irc_t * irc)
irc_connection_list = g_slist_remove( irc_connection_list, irc );
for (account = irc->accounts; account; account = account->next) {
- if (account->gc) {
- account->gc->wants_to_die = TRUE;
- signoff(account->gc);
+ if (account->ic) {
+ account->ic->wants_to_die = TRUE;
+ signoff(account->ic);
} else if (account->reconnect) {
cancel_auto_reconnect(account);
}
@@ -255,7 +255,7 @@ void irc_free(irc_t * irc)
query_del(irc, irc->queries);
while (irc->accounts)
- if (irc->accounts->gc == NULL)
+ if (irc->accounts->ic == NULL)
account_del(irc, irc->accounts);
else
/* Nasty hack, but account_del() doesn't work in this
@@ -632,7 +632,7 @@ void irc_names( irc_t *irc, char *channel )
{
user_t *u;
char namelist[385] = "";
- struct conversation *c = NULL;
+ struct groupchat *c = NULL;
char *ops = set_getstr( &irc->set, "ops" );
/* RFCs say there is no error reply allowed on NAMES, so when the
@@ -648,7 +648,7 @@ void irc_names( irc_t *irc, char *channel )
*namelist = 0;
}
- if( u->gc && !u->away && set_getbool( &irc->set, "away_devoice" ) )
+ if( u->ic && !u->away && set_getbool( &irc->set, "away_devoice" ) )
strcat( namelist, "+" );
else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ||
( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) == 0 ) ) )
@@ -667,7 +667,7 @@ void irc_names( irc_t *irc, char *channel )
sprintf( namelist, "%s%s %s%s ", strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) ? "@" : "", irc->mynick,
strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) ? "@" : "", irc->nick );
- for( l = c->in_room; l; l = l->next ) if( ( u = user_findhandle( c->gc, l->data ) ) )
+ for( l = c->in_room; l; l = l->next ) if( ( u = user_findhandle( c->ic, l->data ) ) )
{
if( strlen( namelist ) + strlen( u->nick ) > sizeof( namelist ) - 4 )
{
@@ -811,7 +811,7 @@ void irc_topic( irc_t *irc, char *channel )
}
else
{
- struct conversation *c = chat_by_channel( channel );
+ struct groupchat *c = chat_by_channel( channel );
if( c )
irc_reply( irc, 332, "%s :BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", channel, c->title );
@@ -910,17 +910,17 @@ void irc_kill( irc_t *irc, user_t *u )
char *nick, *s;
char reason[128];
- if( u->gc && u->gc->flags & OPT_LOGGING_OUT )
+ if( u->ic && u->ic->flags & OPT_LOGGING_OUT )
{
- if( u->gc->acc->server )
+ if( u->ic->acc->server )
g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
- u->gc->acc->server );
- else if( ( s = strchr( u->gc->username, '@' ) ) )
+ u->ic->acc->server );
+ else if( ( s = strchr( u->ic->username, '@' ) ) )
g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
s + 1 );
else
g_snprintf( reason, sizeof( reason ), "%s %s.%s", irc->myhost,
- u->gc->acc->prpl->name, irc->myhost );
+ u->ic->acc->prpl->name, irc->myhost );
/* proto_opt might contain garbage after the : */
if( ( s = strchr( reason, ':' ) ) )
@@ -944,7 +944,7 @@ void irc_kill( irc_t *irc, user_t *u )
int irc_send( irc_t *irc, char *nick, char *s, int flags )
{
- struct conversation *c = NULL;
+ struct groupchat *c = NULL;
user_t *u = NULL;
if( *nick == '#' || *nick == '&' )
@@ -996,13 +996,13 @@ int irc_send( irc_t *irc, char *nick, char *s, int flags )
}
else if( g_strncasecmp( s + 1, "TYPING", 6 ) == 0 )
{
- if( u && u->gc && u->gc->acc->prpl->send_typing && strlen( s ) >= 10 )
+ if( u && u->ic && u->ic->acc->prpl->send_typing && strlen( s ) >= 10 )
{
time_t current_typing_notice = time( NULL );
if( current_typing_notice - u->last_typing_notice >= 5 )
{
- u->gc->acc->prpl->send_typing( u->gc, u->handle, s[8] == '1' );
+ u->ic->acc->prpl->send_typing( u->ic, u->handle, s[8] == '1' );
u->last_typing_notice = current_typing_notice;
}
}
@@ -1035,9 +1035,9 @@ int irc_send( irc_t *irc, char *nick, char *s, int flags )
return 1;
}
}
- else if( c && c->gc && c->gc->acc && c->gc->acc->prpl )
+ else if( c && c->ic && c->ic->acc && c->ic->acc->prpl )
{
- return( bim_chat_msg( c, s ) );
+ return( bim_chat_msg( c, s, 0 ) );
}
return( 0 );
@@ -1052,7 +1052,7 @@ static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_cond
return FALSE;
u->sendbuf[u->sendbuf_len-2] = 0; /* Cut off the last newline */
- bim_buddy_msg( u->gc, u->handle, u->sendbuf, u->sendbuf_flags );
+ bim_buddy_msg( u->ic, u->handle, u->sendbuf, u->sendbuf_flags );
g_free( u->sendbuf );
u->sendbuf = NULL;
@@ -1065,7 +1065,7 @@ static gboolean buddy_send_handler_delayed( gpointer data, gint fd, b_input_cond
void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )
{
- if( !u || !u->gc ) return;
+ if( !u || !u->ic ) return;
if( set_getbool( &irc->set, "buddy_sendbuffer" ) && set_getint( &irc->set, "buddy_sendbuffer_delay" ) > 0 )
{
@@ -1104,7 +1104,7 @@ void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags )
}
else
{
- bim_buddy_msg( u->gc, u->handle, msg, flags );
+ bim_buddy_msg( u->ic, u->handle, msg, flags );
}
}
diff --git a/irc_commands.c b/irc_commands.c
index 023bd0d4..d65cf720 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -133,7 +133,7 @@ static void irc_cmd_names( irc_t *irc, char **cmd )
static void irc_cmd_part( irc_t *irc, char **cmd )
{
- struct conversation *c;
+ struct groupchat *c;
if( g_strcasecmp( cmd[1], irc->channel ) == 0 )
{
@@ -149,10 +149,10 @@ static void irc_cmd_part( irc_t *irc, char **cmd )
irc_part( irc, u, c->channel );
- if( c->gc )
+ if( c->ic )
{
c->joined = 0;
- c->gc->acc->prpl->chat_leave( c );
+ c->ic->acc->prpl->chat_leave( c );
}
}
else
@@ -172,11 +172,11 @@ static void irc_cmd_join( irc_t *irc, char **cmd )
{
user_t *u = user_find( irc, cmd[1] + 1 );
- if( u && u->gc && u->gc->acc->prpl->chat_open )
+ if( u && u->ic && u->ic->acc->prpl->chat_with )
{
irc_reply( irc, 403, "%s :Initializing groupchat in a different channel", cmd[1] );
- if( !u->gc->acc->prpl->chat_open( u->gc, u->handle ) )
+ if( !u->ic->acc->prpl->chat_with( u->ic, u->handle ) )
{
irc_usermsg( irc, "Could not open a groupchat with %s.", u->nick );
}
@@ -200,13 +200,13 @@ static void irc_cmd_join( irc_t *irc, char **cmd )
static void irc_cmd_invite( irc_t *irc, char **cmd )
{
char *nick = cmd[1], *channel = cmd[2];
- struct conversation *c = chat_by_channel( channel );
+ struct groupchat *c = chat_by_channel( channel );
user_t *u = user_find( irc, nick );
- if( u && c && ( u->gc == c->gc ) )
- if( c->gc && c->gc->acc->prpl->chat_invite )
+ if( u && c && ( u->ic == c->ic ) )
+ if( c->ic && c->ic->acc->prpl->chat_invite )
{
- c->gc->acc->prpl->chat_invite( c, "", u->handle );
+ c->ic->acc->prpl->chat_invite( c, "", u->handle );
irc_reply( irc, 341, "%s %s", nick, channel );
return;
}
@@ -270,7 +270,7 @@ static void irc_cmd_who( irc_t *irc, char **cmd )
{
char *channel = cmd[1];
user_t *u = irc->users;
- struct conversation *c;
+ struct groupchat *c;
GList *l;
if( !channel || *channel == '0' || *channel == '*' || !*channel )
@@ -289,7 +289,7 @@ static void irc_cmd_who( irc_t *irc, char **cmd )
else if( ( c = chat_by_channel( channel ) ) )
for( l = c->in_room; l; l = l->next )
{
- if( ( u = user_findhandle( c->gc, l->data ) ) )
+ if( ( u = user_findhandle( c->ic, l->data ) ) )
irc_reply( irc, 352, "%s %s %s %s %s %c :0 %s", channel, u->user, u->host, irc->myhost, u->nick, u->away ? 'G' : 'H', u->realname );
}
else if( ( u = user_find( irc, channel ) ) )
@@ -459,10 +459,10 @@ static void irc_cmd_away( irc_t *irc, char **cmd )
for( a = irc->accounts; a; a = a->next )
{
- struct gaim_connection *gc = a->gc;
+ struct im_connection *ic = a->ic;
- if( gc && gc->flags & OPT_LOGGED_IN )
- bim_set_away( gc, u->away );
+ if( ic && ic->flags & OPT_LOGGED_IN )
+ bim_set_away( ic, u->away );
}
}
@@ -475,10 +475,10 @@ static void irc_cmd_whois( irc_t *irc, char **cmd )
{
irc_reply( irc, 311, "%s %s %s * :%s", u->nick, u->user, u->host, u->realname );
- if( u->gc )
- irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->gc->acc->user,
- u->gc->acc->server && *u->gc->acc->server ? u->gc->acc->server : "",
- u->gc->acc->prpl->name );
+ if( u->ic )
+ irc_reply( irc, 312, "%s %s.%s :%s network", u->nick, u->ic->acc->user,
+ u->ic->acc->server && *u->ic->acc->server ? u->ic->acc->server : "",
+ u->ic->acc->prpl->name );
else
irc_reply( irc, 312, "%s %s :%s", u->nick, irc->myhost, IRCD_INFO );
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c
index f05cc93d..6e699301 100644
--- a/protocols/jabber/io.c
+++ b/protocols/jabber/io.c
@@ -25,23 +25,23 @@
#include "ssl_client.h"
static gboolean jabber_write_callback( gpointer data, gint fd, b_input_condition cond );
-static gboolean jabber_write_queue( struct gaim_connection *gc );
+static gboolean jabber_write_queue( struct im_connection *ic );
-int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node )
+int jabber_write_packet( struct im_connection *ic, struct xt_node *node )
{
char *buf;
int st;
buf = xt_to_string( node );
- st = jabber_write( gc, buf, strlen( buf ) );
+ st = jabber_write( ic, buf, strlen( buf ) );
g_free( buf );
return st;
}
-int jabber_write( struct gaim_connection *gc, char *buf, int len )
+int jabber_write( struct im_connection *ic, char *buf, int len )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
gboolean ret;
if( jd->tx_len == 0 )
@@ -53,8 +53,8 @@ int jabber_write( struct gaim_connection *gc, char *buf, int len )
/* Try if we can write it immediately so we don't have to do
it via the event handler. If not, add the handler. (In
most cases it probably won't be necessary.) */
- if( ( ret = jabber_write_queue( gc ) ) && jd->tx_len > 0 )
- jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, gc );
+ if( ( ret = jabber_write_queue( ic ) ) && jd->tx_len > 0 )
+ jd->w_inpa = b_input_add( jd->fd, GAIM_INPUT_WRITE, jabber_write_callback, ic );
}
else
{
@@ -84,16 +84,16 @@ int jabber_write( struct gaim_connection *gc, char *buf, int len )
the socket is ready for more data). */
static gboolean jabber_write_callback( gpointer data, gint fd, b_input_condition cond )
{
- struct jabber_data *jd = ((struct gaim_connection *)data)->proto_data;
+ struct jabber_data *jd = ((struct im_connection *)data)->proto_data;
return jd->fd != -1 &&
jabber_write_queue( data ) &&
jd->tx_len > 0;
}
-static gboolean jabber_write_queue( struct gaim_connection *gc )
+static gboolean jabber_write_queue( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
int st;
if( jd->ssl )
@@ -116,8 +116,8 @@ static gboolean jabber_write_queue( struct gaim_connection *gc )
closesocket( jd->fd ); /* Shouldn't be necessary after errors? */
jd->fd = -1;
- hide_login_progress_error( gc, "Short write() to server" );
- signoff( gc );
+ hide_login_progress_error( ic, "Short write() to server" );
+ signoff( ic );
return FALSE;
}
else if( st > 0 )
@@ -141,8 +141,8 @@ static gboolean jabber_write_queue( struct gaim_connection *gc )
static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition cond )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
char buf[512];
int st;
@@ -159,8 +159,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
/* Parse. */
if( xt_feed( jd->xt, buf, st ) < 0 )
{
- hide_login_progress_error( gc, "XML stream error" );
- signoff( gc );
+ hide_login_progress_error( ic, "XML stream error" );
+ signoff( ic );
return FALSE;
}
@@ -175,7 +175,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
if( jd->flags & JFLAG_STREAM_RESTART )
{
jd->flags &= ~JFLAG_STREAM_RESTART;
- jabber_start_stream( gc );
+ jabber_start_stream( ic );
}
/* Garbage collection. */
@@ -195,28 +195,28 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
/* If there's no version attribute, assume
this is an old server that can't do SASL
authentication. */
- if( !sasl_supported( gc ) )
+ if( !sasl_supported( ic ) )
{
/* If there's no version= tag, we suppose
this server does NOT implement: XMPP 1.0,
SASL and TLS. */
- if( set_getbool( &gc->acc->set, "tls" ) )
+ if( set_getbool( &ic->acc->set, "tls" ) )
{
- hide_login_progress( gc, "TLS is turned on for this "
+ hide_login_progress( ic, "TLS is turned on for this "
"account, but is not supported by this server" );
- signoff( gc );
+ signoff( ic );
return FALSE;
}
else
{
- return jabber_init_iq_auth( gc );
+ return jabber_init_iq_auth( ic );
}
}
}
else
{
- hide_login_progress( gc, "XML stream error" );
- signoff( gc );
+ hide_login_progress( ic, "XML stream error" );
+ signoff( ic );
return FALSE;
}
}
@@ -226,8 +226,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
closesocket( jd->fd );
jd->fd = -1;
- hide_login_progress_error( gc, "Error while reading from server" );
- signoff( gc );
+ hide_login_progress_error( ic, "Error while reading from server" );
+ signoff( ic );
return FALSE;
}
@@ -237,24 +237,24 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond )
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
if( source == -1 )
{
- hide_login_progress( gc, "Could not connect to server" );
- signoff( gc );
+ hide_login_progress( ic, "Could not connect to server" );
+ signoff( ic );
return FALSE;
}
- set_login_progress( gc, 1, "Connected to server, logging in" );
+ set_login_progress( ic, 1, "Connected to server, logging in" );
- return jabber_start_stream( gc );
+ return jabber_start_stream( ic );
}
gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition cond )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
if( source == NULL )
{
@@ -262,14 +262,14 @@ gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition co
already, set it to NULL here to prevent a double cleanup: */
jd->ssl = NULL;
- hide_login_progress( gc, "Could not connect to server" );
- signoff( gc );
+ hide_login_progress( ic, "Could not connect to server" );
+ signoff( ic );
return FALSE;
}
- set_login_progress( gc, 1, "Connected to server, logging in" );
+ set_login_progress( ic, 1, "Connected to server, logging in" );
- return jabber_start_stream( gc );
+ return jabber_start_stream( ic );
}
static xt_status jabber_end_of_stream( struct xt_node *node, gpointer data )
@@ -280,12 +280,12 @@ static xt_status jabber_end_of_stream( struct xt_node *node, gpointer data )
static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *c, *reply;
int trytls;
- trytls = g_strcasecmp( set_getstr( &gc->acc->set, "tls" ), "try" ) == 0;
+ trytls = g_strcasecmp( set_getstr( &ic->acc->set, "tls" ), "try" ) == 0;
c = xt_find_node( node->children, "starttls" );
if( c && !jd->ssl )
{
@@ -294,20 +294,20 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
c = xt_find_node( c->children, "required" );
- if( c && ( !trytls && !set_getbool( &gc->acc->set, "tls" ) ) )
+ if( c && ( !trytls && !set_getbool( &ic->acc->set, "tls" ) ) )
{
- hide_login_progress( gc, "Server requires TLS connections, but TLS is turned off for this account" );
- signoff( gc );
+ hide_login_progress( ic, "Server requires TLS connections, but TLS is turned off for this account" );
+ signoff( ic );
return XT_ABORT;
}
/* Only run this if the tls setting is set to true or try: */
- if( ( trytls || set_getbool( &gc->acc->set, "tls" ) ) )
+ if( ( trytls || set_getbool( &ic->acc->set, "tls" ) ) )
{
reply = xt_new_node( "starttls", NULL, NULL );
xt_add_attr( reply, "xmlns", XMLNS_TLS );
- if( !jabber_write_packet( gc, reply ) )
+ if( !jabber_write_packet( ic, reply ) )
{
xt_free_node( reply );
return XT_ABORT;
@@ -324,10 +324,10 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
habit of not advertising <starttls/> anymore when already
using SSL/TLS. */
- if( !trytls && set_getbool( &gc->acc->set, "tls" ) )
+ if( !trytls && set_getbool( &ic->acc->set, "tls" ) )
{
- hide_login_progress( gc, "TLS is turned on for this account, but is not supported by this server" );
- signoff( gc );
+ hide_login_progress( ic, "TLS is turned on for this account, but is not supported by this server" );
+ signoff( ic );
return XT_ABORT;
}
@@ -345,20 +345,20 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
support it after all, we should try to do authentication the
other way. jabber.com doesn't seem to do SASL while it pretends
to be XMPP 1.0 compliant! */
- else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( gc ) )
+ else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( ic ) )
{
- if( !jabber_init_iq_auth( gc ) )
+ if( !jabber_init_iq_auth( ic ) )
return XT_ABORT;
}
if( ( c = xt_find_node( node->children, "bind" ) ) )
{
- reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
+ reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
xt_add_attr( reply, "xmlns", XMLNS_BIND );
reply = jabber_make_packet( "iq", "set", NULL, reply );
- jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
+ jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
- if( !jabber_write_packet( gc, reply ) )
+ if( !jabber_write_packet( ic, reply ) )
return XT_ABORT;
jd->flags |= JFLAG_WAIT_BIND;
@@ -369,9 +369,9 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
reply = xt_new_node( "session", NULL, NULL );
xt_add_attr( reply, "xmlns", XMLNS_SESSION );
reply = jabber_make_packet( "iq", "set", NULL, reply );
- jabber_cache_add( gc, reply, jabber_pkt_bind_sess );
+ jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
- if( !jabber_write_packet( gc, reply ) )
+ if( !jabber_write_packet( ic, reply ) )
return XT_ABORT;
jd->flags |= JFLAG_WAIT_SESSION;
@@ -382,7 +382,7 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
to bind/initialize the session. */
if( jd->flags & JFLAG_AUTHENTICATED && ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
{
- if( !jabber_get_roster( gc ) )
+ if( !jabber_get_roster( ic ) )
return XT_ABORT;
}
@@ -391,8 +391,8 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data )
static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
char *xmlns;
xmlns = xt_find_attr( node, "xmlns" );
@@ -416,16 +416,16 @@ static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data )
}
jd->w_inpa = jd->r_inpa = 0;
- set_login_progress( gc, 1, "Converting stream to TLS" );
+ set_login_progress( ic, 1, "Converting stream to TLS" );
- jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, gc );
+ jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic );
return XT_HANDLED;
}
static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
struct xt_node *c;
char *s, *type = NULL, *text = NULL;
@@ -451,8 +451,8 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
/* Tssk... */
if( type == NULL )
{
- hide_login_progress_error( gc, "Unknown stream error reported by server" );
- signoff( gc );
+ hide_login_progress_error( ic, "Unknown stream error reported by server" );
+ signoff( ic );
return XT_ABORT;
}
@@ -461,17 +461,17 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
infinite loop! */
if( strcmp( type, "conflict" ) == 0 )
{
- hide_login_progress( gc, "Account and resource used from a different location" );
- gc->wants_to_die = TRUE;
+ hide_login_progress( ic, "Account and resource used from a different location" );
+ ic->wants_to_die = TRUE;
}
else
{
s = g_strdup_printf( "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" );
- hide_login_progress_error( gc, s );
+ hide_login_progress_error( ic, s );
g_free( s );
}
- signoff( gc );
+ signoff( ic );
return XT_ABORT;
}
@@ -499,35 +499,35 @@ static const struct xt_handler_entry jabber_handlers[] = {
{ NULL, NULL, NULL }
};
-gboolean jabber_start_stream( struct gaim_connection *gc )
+gboolean jabber_start_stream( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
int st;
char *greet;
/* We'll start our stream now, so prepare everything to receive one
from the server too. */
xt_free( jd->xt ); /* In case we're RE-starting. */
- jd->xt = xt_new( gc );
+ jd->xt = xt_new( ic );
jd->xt->handlers = (struct xt_handler_entry*) jabber_handlers;
if( jd->r_inpa <= 0 )
- jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, gc );
+ jd->r_inpa = b_input_add( jd->fd, GAIM_INPUT_READ, jabber_read_callback, ic );
greet = g_strdup_printf( "<?xml version='1.0' ?>"
"<stream:stream to=\"%s\" xmlns=\"jabber:client\" "
"xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">", jd->server );
- st = jabber_write( gc, greet, strlen( greet ) );
+ st = jabber_write( ic, greet, strlen( greet ) );
g_free( greet );
return st;
}
-void jabber_end_stream( struct gaim_connection *gc )
+void jabber_end_stream( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
/* Let's only do this if the queue is currently empty, otherwise it'd
take too long anyway. */
@@ -537,14 +537,14 @@ void jabber_end_stream( struct gaim_connection *gc )
struct xt_node *node;
int st = 1;
- if( gc->flags & OPT_LOGGED_IN )
+ if( ic->flags & OPT_LOGGED_IN )
{
node = jabber_make_packet( "presence", "unavailable", NULL, NULL );
- st = jabber_write_packet( gc, node );
+ st = jabber_write_packet( ic, node );
xt_free_node( node );
}
if( st )
- jabber_write( gc, eos, strlen( eos ) );
+ jabber_write( ic, eos, strlen( eos ) );
}
}
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index 914dd02b..86d97e15 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -23,13 +23,13 @@
#include "jabber.h"
-static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
-static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
+static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
+static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *c, *reply = NULL;
char *type, *s;
int st, pack = 1;
@@ -38,8 +38,8 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
if( !type )
{
- hide_login_progress_error( gc, "Received IQ packet without type." );
- signoff( gc );
+ hide_login_progress_error( ic, "Received IQ packet without type." );
+ signoff( ic );
return XT_ABORT;
}
@@ -59,16 +59,16 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
entry = g_hash_table_lookup( jd->node_cache, s );
if( entry == NULL )
- serv_got_crap( gc, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
+ serv_got_crap( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
else if( entry->func )
- return entry->func( gc, node, entry->node );
+ return entry->func( ic, node, entry->node );
}
else if( strcmp( type, "get" ) == 0 )
{
if( !( c = xt_find_node( node->children, "query" ) ) ||
!( s = xt_find_attr( c, "xmlns" ) ) )
{
- serv_got_crap( gc, "WARNING: Received incomplete IQ-%s packet", type );
+ serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
return XT_HANDLED;
}
@@ -131,7 +131,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
if( !( c = xt_find_node( node->children, "query" ) ) ||
!( s = xt_find_attr( c, "xmlns" ) ) )
{
- serv_got_crap( gc, "WARNING: Received incomplete IQ-%s packet", type );
+ serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
return XT_HANDLED;
}
@@ -140,20 +140,20 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
sent even if we added this buddy in our own session. */
if( strcmp( s, XMLNS_ROSTER ) == 0 )
{
- int bare_len = strlen( gc->acc->user );
+ int bare_len = strlen( ic->acc->user );
if( ( s = xt_find_attr( node, "from" ) ) == NULL ||
- ( strncmp( s, gc->acc->user, bare_len ) == 0 &&
+ ( strncmp( s, ic->acc->user, bare_len ) == 0 &&
( s[bare_len] == 0 || s[bare_len] == '/' ) ) )
{
- jabber_parse_roster( gc, node, NULL );
+ jabber_parse_roster( ic, node, NULL );
/* Should we generate a reply here? Don't think it's
very important... */
}
else
{
- serv_got_crap( gc, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
+ serv_got_crap( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
xt_free_node( reply );
reply = jabber_make_error_packet( node, "not-allowed", "cancel" );
@@ -181,7 +181,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
xt_add_attr( reply, "id", s );
}
- st = jabber_write_packet( gc, reply );
+ st = jabber_write_packet( ic, reply );
xt_free_node( reply );
if( !st )
return XT_ABORT;
@@ -190,12 +190,12 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
return XT_HANDLED;
}
-static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
-static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
+static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
+static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
-int jabber_init_iq_auth( struct gaim_connection *gc )
+int jabber_init_iq_auth( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *node;
int st;
@@ -203,23 +203,23 @@ int jabber_init_iq_auth( struct gaim_connection *gc )
xt_add_attr( node, "xmlns", XMLNS_AUTH );
node = jabber_make_packet( "iq", "get", NULL, node );
- jabber_cache_add( gc, node, jabber_do_iq_auth );
- st = jabber_write_packet( gc, node );
+ jabber_cache_add( ic, node, jabber_do_iq_auth );
+ st = jabber_write_packet( ic, node );
return st;
}
-static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
+static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *reply, *query;
xt_status st;
char *s;
if( !( query = xt_find_node( node->children, "query" ) ) )
{
- serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
- signoff( gc );
+ serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
+ signoff( ic );
return XT_HANDLED;
}
@@ -227,7 +227,7 @@ static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *
reply = xt_new_node( "query", NULL, NULL );
xt_add_attr( reply, "xmlns", XMLNS_AUTH );
xt_add_child( reply, xt_new_node( "username", jd->username, NULL ) );
- xt_add_child( reply, xt_new_node( "resource", set_getstr( &gc->acc->set, "resource" ), NULL ) );
+ xt_add_child( reply, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
if( xt_find_node( query->children, "digest" ) && ( s = xt_find_attr( jd->xt->root, "id" ) ) )
{
@@ -240,7 +240,7 @@ static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *
shaInit( &sha );
shaUpdate( &sha, (unsigned char*) s, strlen( s ) );
- shaUpdate( &sha, (unsigned char*) gc->acc->pass, strlen( gc->acc->pass ) );
+ shaUpdate( &sha, (unsigned char*) ic->acc->pass, strlen( ic->acc->pass ) );
shaFinal( &sha, hash );
for( i = 0; i < 20; i ++ )
@@ -251,40 +251,40 @@ static xt_status jabber_do_iq_auth( struct gaim_connection *gc, struct xt_node *
else if( xt_find_node( query->children, "password" ) )
{
/* We'll have to stick with plaintext. Let's hope we're using SSL/TLS... */
- xt_add_child( reply, xt_new_node( "password", gc->acc->pass, NULL ) );
+ xt_add_child( reply, xt_new_node( "password", ic->acc->pass, NULL ) );
}
else
{
xt_free_node( reply );
- hide_login_progress( gc, "Can't find suitable authentication method" );
- signoff( gc );
+ hide_login_progress( ic, "Can't find suitable authentication method" );
+ signoff( ic );
return XT_ABORT;
}
reply = jabber_make_packet( "iq", "set", NULL, reply );
- jabber_cache_add( gc, reply, jabber_finish_iq_auth );
- st = jabber_write_packet( gc, reply );
+ jabber_cache_add( ic, reply, jabber_finish_iq_auth );
+ st = jabber_write_packet( ic, reply );
return st ? XT_HANDLED : XT_ABORT;
}
-static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
+static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
char *type;
if( !( type = xt_find_attr( node, "type" ) ) )
{
- serv_got_crap( gc, "WARNING: Received incomplete IQ packet while authenticating" );
- signoff( gc );
+ serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
+ signoff( ic );
return XT_HANDLED;
}
if( strcmp( type, "error" ) == 0 )
{
- hide_login_progress( gc, "Authentication failure" );
- signoff( gc );
+ hide_login_progress( ic, "Authentication failure" );
+ signoff( ic );
return XT_ABORT;
}
else if( strcmp( type, "result" ) == 0 )
@@ -292,16 +292,16 @@ static xt_status jabber_finish_iq_auth( struct gaim_connection *gc, struct xt_no
/* This happens when we just successfully authenticated the
old (non-SASL) way. */
jd->flags |= JFLAG_AUTHENTICATED;
- if( !jabber_get_roster( gc ) )
+ if( !jabber_get_roster( ic ) )
return XT_ABORT;
}
return XT_HANDLED;
}
-xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
+xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *c;
char *s;
@@ -309,8 +309,8 @@ xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node
{
c = xt_find_node( c->children, "jid" );
if( c && c->text_len && ( s = strchr( c->text, '/' ) ) &&
- strcmp( s + 1, set_getstr( &gc->acc->set, "resource" ) ) != 0 )
- serv_got_crap( gc, "Server changed session resource string to `%s'", s + 1 );
+ strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
+ serv_got_crap( ic, "Server changed session resource string to `%s'", s + 1 );
jd->flags &= ~JFLAG_WAIT_BIND;
}
@@ -321,38 +321,38 @@ xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node
if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
{
- if( !jabber_get_roster( gc ) )
+ if( !jabber_get_roster( ic ) )
return XT_ABORT;
}
return XT_HANDLED;
}
-int jabber_get_roster( struct gaim_connection *gc )
+int jabber_get_roster( struct im_connection *ic )
{
struct xt_node *node;
int st;
- set_login_progress( gc, 1, "Authenticated, requesting buddy list" );
+ set_login_progress( ic, 1, "Authenticated, requesting buddy list" );
node = xt_new_node( "query", NULL, NULL );
xt_add_attr( node, "xmlns", XMLNS_ROSTER );
node = jabber_make_packet( "iq", "get", NULL, node );
- jabber_cache_add( gc, node, jabber_parse_roster );
- st = jabber_write_packet( gc, node );
+ jabber_cache_add( ic, node, jabber_parse_roster );
+ st = jabber_write_packet( ic, node );
return st;
}
-static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
+static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
{
struct xt_node *query, *c;
int initial = ( orig != NULL );
if( !( query = xt_find_node( node->children, "query" ) ) )
{
- serv_got_crap( gc, "WARNING: Received NULL roster packet" );
+ serv_got_crap( ic, "WARNING: Received NULL roster packet" );
return XT_HANDLED;
}
@@ -370,24 +370,24 @@ static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node
else if( initial )
{
if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
- add_buddy( gc, NULL, jid, name );
+ add_buddy( ic, NULL, jid, name );
}
else
{
/* This is a roster push item. Find out what changed exactly. */
if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
{
- if( find_buddy( gc, jid ) == NULL )
- add_buddy( gc, NULL, jid, name );
+ if( find_buddy( ic, jid ) == NULL )
+ add_buddy( ic, NULL, jid, name );
else if( name )
- serv_buddy_rename( gc, jid, name );
+ serv_buddy_rename( ic, jid, name );
}
else if( strcmp( sub, "remove" ) == 0 )
{
/* Don't have any API call for this yet! So let's
just try to handle this as well as we can. */
- jabber_buddy_remove_bare( gc, jid );
- serv_got_update( gc, jid, 0, 0, 0, 0, 0, 0 );
+ jabber_buddy_remove_bare( ic, jid );
+ serv_got_update( ic, jid, 0, 0, 0, 0, 0, 0 );
/* FIXME! */
}
}
@@ -396,12 +396,12 @@ static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node
}
if( initial )
- account_online( gc );
+ account_online( ic );
return XT_HANDLED;
}
-int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid )
+int jabber_get_vcard( struct im_connection *ic, char *bare_jid )
{
struct xt_node *node;
@@ -412,13 +412,13 @@ int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid )
xt_add_attr( node, "xmlns", XMLNS_VCARD );
node = jabber_make_packet( "iq", "get", bare_jid, node );
- jabber_cache_add( gc, node, jabber_iq_display_vcard );
- return jabber_write_packet( gc, node );
+ jabber_cache_add( ic, node, jabber_iq_display_vcard );
+ return jabber_write_packet( ic, node );
}
-static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig )
+static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
{
- struct xt_node *vc, *c, *sc; /* subchild, gc is already in use ;-) */
+ struct xt_node *vc, *c, *sc; /* subchild, ic is already in use ;-) */
GString *reply;
char *s;
@@ -427,7 +427,7 @@ static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_
( vc = xt_find_node( node->children, "vCard" ) ) == NULL )
{
s = xt_find_attr( orig, "to" ); /* If this returns NULL something's wrong.. */
- serv_got_crap( gc, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
+ serv_got_crap( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
return XT_HANDLED;
}
@@ -535,13 +535,13 @@ static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_
/* *sigh* */
- serv_got_crap( gc, reply->str );
+ serv_got_crap( ic, reply->str );
g_string_free( reply, TRUE );
return XT_HANDLED;
}
-int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name )
+int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name )
{
struct xt_node *node;
int st;
@@ -557,13 +557,13 @@ int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name )
xt_add_attr( node, "xmlns", XMLNS_ROSTER );
node = jabber_make_packet( "iq", "set", NULL, node );
- st = jabber_write_packet( gc, node );
+ st = jabber_write_packet( ic, node );
xt_free_node( node );
return st;
}
-int jabber_remove_from_roster( struct gaim_connection *gc, char *handle )
+int jabber_remove_from_roster( struct im_connection *ic, char *handle )
{
struct xt_node *node;
int st;
@@ -578,7 +578,7 @@ int jabber_remove_from_roster( struct gaim_connection *gc, char *handle )
xt_add_attr( node, "xmlns", XMLNS_ROSTER );
node = jabber_make_packet( "iq", "set", NULL, node );
- st = jabber_write_packet( gc, node );
+ st = jabber_write_packet( ic, node );
xt_free_node( node );
return st;
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index fa9c3473..23de1103 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -32,7 +32,7 @@
#include "bitlbee.h"
#include "jabber.h"
-static void jabber_acc_init( account_t *acc )
+static void jabber_init( account_t *acc )
{
set_t *s;
@@ -58,21 +58,21 @@ static void jabber_acc_init( account_t *acc )
static void jabber_login( account_t *acc )
{
- struct gaim_connection *gc = new_gaim_conn( acc );
+ struct im_connection *ic = new_gaim_conn( acc );
struct jabber_data *jd = g_new0( struct jabber_data, 1 );
struct ns_srv_reply *srv = NULL;
char *connect_to, *s;
- jd->gc = gc;
- gc->proto_data = jd;
+ jd->ic = ic;
+ ic->proto_data = jd;
jd->username = g_strdup( acc->user );
jd->server = strchr( jd->username, '@' );
if( jd->server == NULL )
{
- hide_login_progress( gc, "Incomplete account name (format it like <username@jabberserver.name>)" );
- signoff( gc );
+ hide_login_progress( ic, "Incomplete account name (format it like <username@jabberserver.name>)" );
+ signoff( ic );
return;
}
@@ -158,14 +158,14 @@ static void jabber_login( account_t *acc )
else
connect_to = jd->server;
- set_login_progress( gc, 0, "Connecting" );
+ set_login_progress( ic, 0, "Connecting" );
if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN ||
set_getint( &acc->set, "port" ) > JABBER_PORT_MAX )
{
- serv_got_crap( gc, "Incorrect port number, must be in the %d-%d range",
+ serv_got_crap( ic, "Incorrect port number, must be in the %d-%d range",
JABBER_PORT_MIN, JABBER_PORT_MAX );
- signoff( gc );
+ signoff( ic );
return;
}
@@ -174,27 +174,27 @@ static void jabber_login( account_t *acc )
non-standard ports... */
if( set_getbool( &acc->set, "ssl" ) )
{
- jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, gc );
+ jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), jabber_connected_ssl, ic );
jd->fd = jd->ssl ? ssl_getfd( jd->ssl ) : -1;
}
else
{
- jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, gc );
+ jd->fd = proxy_connect( connect_to, srv ? srv->port : set_getint( &acc->set, "port" ), jabber_connected_plain, ic );
}
g_free( srv );
if( jd->fd == -1 )
{
- hide_login_progress( gc, "Could not connect to server" );
- signoff( gc );
+ hide_login_progress( ic, "Could not connect to server" );
+ signoff( ic );
}
}
-static void jabber_close( struct gaim_connection *gc )
+static void jabber_logout( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
- jabber_end_stream( gc );
+ jabber_end_stream( ic );
if( jd->r_inpa >= 0 )
b_event_remove( jd->r_inpa );
@@ -218,14 +218,14 @@ static void jabber_close( struct gaim_connection *gc )
g_free( jd );
}
-static int jabber_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away )
+static int jabber_send_im( struct im_connection *ic, char *who, char *message, int flags )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud;
struct xt_node *node;
int st;
- bud = jabber_buddy_by_jid( gc, who, 0 );
+ bud = jabber_buddy_by_jid( ic, who, 0 );
node = xt_new_node( "body", message, NULL );
node = jabber_make_packet( "message", "chat", bud ? bud->full_jid : who, node );
@@ -250,13 +250,13 @@ static int jabber_send_im( struct gaim_connection *gc, char *who, char *message,
bud->flags |= JBFLAG_PROBED_XEP85;
}
- st = jabber_write_packet( gc, node );
+ st = jabber_write_packet( ic, node );
xt_free_node( node );
return st;
}
-static GList *jabber_away_states( struct gaim_connection *gc )
+static GList *jabber_away_states( struct im_connection *ic )
{
static GList *l = NULL;
int i;
@@ -268,13 +268,13 @@ static GList *jabber_away_states( struct gaim_connection *gc )
return l;
}
-static void jabber_get_info( struct gaim_connection *gc, char *who )
+static void jabber_get_info( struct im_connection *ic, char *who )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud;
if( strchr( who, '/' ) )
- bud = jabber_buddy_by_jid( gc, who, 0 );
+ bud = jabber_buddy_by_jid( ic, who, 0 );
else
{
char *s = jabber_normalize( who );
@@ -284,19 +284,19 @@ static void jabber_get_info( struct gaim_connection *gc, char *who )
while( bud )
{
- serv_got_crap( gc, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
+ serv_got_crap( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
bud->full_jid, bud->priority,
bud->away_state ? bud->away_state->full_name : "(none)",
bud->away_message ? : "(none)" );
bud = bud->next;
}
- jabber_get_vcard( gc, bud ? bud->full_jid : who );
+ jabber_get_vcard( ic, bud ? bud->full_jid : who );
}
-static void jabber_set_away( struct gaim_connection *gc, char *state_txt, char *message )
+static void jabber_set_away( struct im_connection *ic, char *state_txt, char *message )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_away_state *state;
/* Save all this info. We need it, for example, when changing the priority setting. */
@@ -305,43 +305,43 @@ static void jabber_set_away( struct gaim_connection *gc, char *state_txt, char *
g_free( jd->away_message );
jd->away_message = ( message && *message ) ? g_strdup( message ) : NULL;
- presence_send_update( gc );
+ presence_send_update( ic );
}
-static void jabber_add_buddy( struct gaim_connection *gc, char *who )
+static void jabber_add_buddy( struct im_connection *ic, char *who, char *group )
{
- if( jabber_add_to_roster( gc, who, NULL ) )
- presence_send_request( gc, who, "subscribe" );
+ if( jabber_add_to_roster( ic, who, NULL ) )
+ presence_send_request( ic, who, "subscribe" );
}
-static void jabber_remove_buddy( struct gaim_connection *gc, char *who, char *group )
+static void jabber_remove_buddy( struct im_connection *ic, char *who, char *group )
{
/* We should always do this part. Clean up our administration a little bit. */
- jabber_buddy_remove_bare( gc, who );
+ jabber_buddy_remove_bare( ic, who );
- if( jabber_remove_from_roster( gc, who ) )
- presence_send_request( gc, who, "unsubscribe" );
+ if( jabber_remove_from_roster( ic, who ) )
+ presence_send_request( ic, who, "unsubscribe" );
}
-static void jabber_keepalive( struct gaim_connection *gc )
+static void jabber_keepalive( struct im_connection *ic )
{
/* Just any whitespace character is enough as a keepalive for XMPP sessions. */
- jabber_write( gc, "\n", 1 );
+ jabber_write( ic, "\n", 1 );
/* This runs the garbage collection every minute, which means every packet
is in the cache for about a minute (which should be enough AFAIK). */
- jabber_cache_clean( gc );
+ jabber_cache_clean( ic );
}
-static int jabber_send_typing( struct gaim_connection *gc, char *who, int typing )
+static int jabber_send_typing( struct im_connection *ic, char *who, int typing )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud;
/* Enable typing notification related code from now. */
jd->flags |= JFLAG_WANT_TYPING;
- if( ( bud = jabber_buddy_by_jid( gc, who, 0 ) ) == NULL )
+ if( ( bud = jabber_buddy_by_jid( ic, who, 0 ) ) == NULL )
{
/* Sending typing notifications to unknown buddies is
unsupported for now. Shouldn't be a problem, I think. */
@@ -368,7 +368,7 @@ static int jabber_send_typing( struct gaim_connection *gc, char *who, int typing
xt_add_attr( node, "xmlns", XMLNS_CHATSTATES );
node = jabber_make_packet( "message", "chat", bud->full_jid, node );
- st = jabber_write_packet( gc, node );
+ st = jabber_write_packet( ic, node );
xt_free_node( node );
return st;
@@ -377,14 +377,14 @@ static int jabber_send_typing( struct gaim_connection *gc, char *who, int typing
return 1;
}
-void jabber_init()
+void jabber_initmodule()
{
struct prpl *ret = g_new0( struct prpl, 1 );
ret->name = "jabber";
ret->login = jabber_login;
- ret->acc_init = jabber_acc_init;
- ret->close = jabber_close;
+ ret->init = jabber_init;
+ ret->logout = jabber_logout;
ret->send_im = jabber_send_im;
ret->away_states = jabber_away_states;
// ret->get_status_string = jabber_get_status_string;
diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h
index 0a0f3c2c..42f57ae1 100644
--- a/protocols/jabber/jabber.h
+++ b/protocols/jabber/jabber.h
@@ -57,7 +57,7 @@ typedef enum
struct jabber_data
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
int fd;
void *ssl;
@@ -86,7 +86,7 @@ struct jabber_away_state
char *full_name;
};
-typedef xt_status (*jabber_cache_event) ( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
+typedef xt_status (*jabber_cache_event) ( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
struct jabber_cache_entry
{
@@ -136,33 +136,33 @@ struct jabber_buddy
/* iq.c */
xt_status jabber_pkt_iq( struct xt_node *node, gpointer data );
-int jabber_init_iq_auth( struct gaim_connection *gc );
-xt_status jabber_pkt_bind_sess( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );
-int jabber_get_roster( struct gaim_connection *gc );
-int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid );
-int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name );
-int jabber_remove_from_roster( struct gaim_connection *gc, char *handle );
+int jabber_init_iq_auth( struct im_connection *ic );
+xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig );
+int jabber_get_roster( struct im_connection *ic );
+int jabber_get_vcard( struct im_connection *ic, char *bare_jid );
+int jabber_add_to_roster( struct im_connection *ic, char *handle, char *name );
+int jabber_remove_from_roster( struct im_connection *ic, char *handle );
/* message.c */
xt_status jabber_pkt_message( struct xt_node *node, gpointer data );
/* presence.c */
xt_status jabber_pkt_presence( struct xt_node *node, gpointer data );
-int presence_send_update( struct gaim_connection *gc );
-int presence_send_request( struct gaim_connection *gc, char *handle, char *request );
+int presence_send_update( struct im_connection *ic );
+int presence_send_request( struct im_connection *ic, char *handle, char *request );
/* jabber_util.c */
char *set_eval_priority( set_t *set, char *value );
char *set_eval_tls( set_t *set, char *value );
struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children );
struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type );
-void jabber_cache_add( struct gaim_connection *gc, struct xt_node *node, jabber_cache_event func );
-struct xt_node *jabber_cache_get( struct gaim_connection *gc, char *id );
+void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func );
+struct xt_node *jabber_cache_get( struct im_connection *ic, char *id );
void jabber_cache_entry_free( gpointer entry );
-void jabber_cache_clean( struct gaim_connection *gc );
+void jabber_cache_clean( struct im_connection *ic );
const struct jabber_away_state *jabber_away_state_by_code( char *code );
const struct jabber_away_state *jabber_away_state_by_name( char *name );
-void jabber_buddy_ask( struct gaim_connection *gc, char *handle );
+void jabber_buddy_ask( struct im_connection *ic, char *handle );
char *jabber_normalize( char *orig );
typedef enum
@@ -171,25 +171,25 @@ typedef enum
GET_BUDDY_EXACT = 2, /* Get an exact message (only makes sense with bare JIDs). */
} get_buddy_flags_t;
-struct jabber_buddy *jabber_buddy_add( struct gaim_connection *gc, char *full_jid );
-struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid, get_buddy_flags_t flags );
-int jabber_buddy_remove( struct gaim_connection *gc, char *full_jid );
-int jabber_buddy_remove_bare( struct gaim_connection *gc, char *bare_jid );
+struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid );
+struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid, get_buddy_flags_t flags );
+int jabber_buddy_remove( struct im_connection *ic, char *full_jid );
+int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid );
extern const struct jabber_away_state jabber_away_state_list[];
/* io.c */
-int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node );
-int jabber_write( struct gaim_connection *gc, char *buf, int len );
+int jabber_write_packet( struct im_connection *ic, struct xt_node *node );
+int jabber_write( struct im_connection *ic, char *buf, int len );
gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond );
gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition cond );
-gboolean jabber_start_stream( struct gaim_connection *gc );
-void jabber_end_stream( struct gaim_connection *gc );
+gboolean jabber_start_stream( struct im_connection *ic );
+void jabber_end_stream( struct im_connection *ic );
/* sasl.c */
xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data );
xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data );
xt_status sasl_pkt_result( struct xt_node *node, gpointer data );
-gboolean sasl_supported( struct gaim_connection *gc );
+gboolean sasl_supported( struct im_connection *ic );
#endif
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c
index 4ca0c1fc..cc237b03 100644
--- a/protocols/jabber/jabber_util.c
+++ b/protocols/jabber/jabber_util.c
@@ -41,7 +41,7 @@ char *set_eval_priority( set_t *set, char *value )
/* Only run this stuff if the account is online ATM,
and if the setting seems to be acceptable. */
- if( acc->gc )
+ if( acc->ic )
{
/* Although set_eval functions usually are very nice and
convenient, they have one disadvantage: If I would just
@@ -57,7 +57,7 @@ char *set_eval_priority( set_t *set, char *value )
/* (Yes, sorry, I prefer the hack. :-P) */
- presence_send_update( acc->gc );
+ presence_send_update( acc->ic );
}
return value;
@@ -129,9 +129,9 @@ struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond,
/* Cache a node/packet for later use. Mainly useful for IQ packets if you need
them when you receive the response. Use this BEFORE sending the packet so
it'll get a new id= tag, and do NOT free() the packet after writing it! */
-void jabber_cache_add( struct gaim_connection *gc, struct xt_node *node, jabber_cache_event func )
+void jabber_cache_add( struct im_connection *ic, struct xt_node *node, jabber_cache_event func )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
char *id = g_strdup_printf( "%s%05x", JABBER_CACHED_ID, ( next_id++ ) & 0xfffff );
struct jabber_cache_entry *entry = g_new0( struct jabber_cache_entry, 1 );
@@ -158,9 +158,9 @@ gboolean jabber_cache_clean_entry( gpointer key, gpointer entry, gpointer nullpo
during the first run and deleting marked nodes during a next run, every
node should be available in the cache for at least a minute (assuming the
function is indeed called every minute). */
-void jabber_cache_clean( struct gaim_connection *gc )
+void jabber_cache_clean( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
g_hash_table_foreach_remove( jd->node_cache, jabber_cache_clean_entry, NULL );
}
@@ -213,17 +213,17 @@ const struct jabber_away_state *jabber_away_state_by_name( char *name )
struct jabber_buddy_ask_data
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
char *handle;
char *realname;
};
static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla )
{
- presence_send_request( bla->gc, bla->handle, "subscribed" );
+ presence_send_request( bla->ic, bla->handle, "subscribed" );
- if( find_buddy( bla->gc, bla->handle ) == NULL )
- show_got_added( bla->gc, bla->handle, NULL );
+ if( find_buddy( bla->ic, bla->handle ) == NULL )
+ show_got_added( bla->ic, bla->handle, NULL );
g_free( bla->handle );
g_free( bla );
@@ -231,22 +231,22 @@ static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla
static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla )
{
- presence_send_request( bla->gc, bla->handle, "subscribed" );
+ presence_send_request( bla->ic, bla->handle, "subscribed" );
g_free( bla->handle );
g_free( bla );
}
-void jabber_buddy_ask( struct gaim_connection *gc, char *handle )
+void jabber_buddy_ask( struct im_connection *ic, char *handle )
{
struct jabber_buddy_ask_data *bla = g_new0( struct jabber_buddy_ask_data, 1 );
char *buf;
- bla->gc = gc;
+ bla->ic = ic;
bla->handle = g_strdup( handle );
buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list.", handle );
- do_ask_dialog( gc, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no );
+ do_ask_dialog( ic, buf, bla, jabber_buddy_ask_yes, jabber_buddy_ask_no );
g_free( buf );
}
@@ -270,9 +270,9 @@ char *jabber_normalize( char *orig )
buddies from transports don't (usually) have resources. So we'll really have
to deal with that properly. Set their ->resource property to NULL. Do *NOT*
allow to mix this stuff, though... */
-struct jabber_buddy *jabber_buddy_add( struct gaim_connection *gc, char *full_jid_ )
+struct jabber_buddy *jabber_buddy_add( struct im_connection *ic, char *full_jid_ )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud, *new, *bi;
char *s, *full_jid;
@@ -342,9 +342,9 @@ struct jabber_buddy *jabber_buddy_add( struct gaim_connection *gc, char *full_ji
/* Finds a buddy from our structures. Can find both full- and bare JIDs. When
asked for a bare JID, it uses the "resource_select" setting to see which
resource to pick. */
-struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid_, get_buddy_flags_t flags )
+struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, get_buddy_flags_t flags )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud;
char *s, *jid;
@@ -370,10 +370,10 @@ struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid_
}
}
- if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid ) )
+ if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid ) )
{
*s = '/';
- bud = jabber_buddy_add( gc, jid );
+ bud = jabber_buddy_add( ic, jid );
}
g_free( jid );
@@ -390,8 +390,8 @@ struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid_
if( bud == NULL )
/* No match. Create it now? */
- return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid_ ) ) ?
- jabber_buddy_add( gc, jid_ ) : NULL;
+ return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid_ ) ) ?
+ jabber_buddy_add( ic, jid_ ) : NULL;
else if( bud->resource && ( flags & GET_BUDDY_EXACT ) )
/* We want an exact match, so in thise case there shouldn't be a /resource. */
return NULL;
@@ -408,7 +408,7 @@ struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid_
best_time = bud;
}
- if( ( set = set_getstr( &gc->acc->set, "resource_select" ) ) == NULL )
+ if( ( set = set_getstr( &ic->acc->set, "resource_select" ) ) == NULL )
return NULL;
else if( strcmp( set, "activity" ) == 0 )
return best_time;
@@ -420,9 +420,9 @@ struct jabber_buddy *jabber_buddy_by_jid( struct gaim_connection *gc, char *jid_
/* Remove one specific full JID from our list. Use this when a buddy goes
off-line (because (s)he can still be online from a different location.
XXX: See above, we should accept bare JIDs too... */
-int jabber_buddy_remove( struct gaim_connection *gc, char *full_jid_ )
+int jabber_buddy_remove( struct im_connection *ic, char *full_jid_ )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud, *prev, *bi;
char *s, *full_jid;
@@ -494,9 +494,9 @@ int jabber_buddy_remove( struct gaim_connection *gc, char *full_jid_ )
/* Remove a buddy completely; removes all resources that belong to the
specified bare JID. Use this when removing someone from the contact
list, for example. */
-int jabber_buddy_remove_bare( struct gaim_connection *gc, char *bare_jid_ )
+int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid_ )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud, *next;
char *bare_jid;
diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c
index ac72f661..6c105d1d 100644
--- a/protocols/jabber/message.c
+++ b/protocols/jabber/message.c
@@ -25,7 +25,7 @@
xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
char *from = xt_find_attr( node, "from" );
char *type = xt_find_attr( node, "type" );
struct xt_node *body = xt_find_node( node->children, "body" ), *c;
@@ -46,7 +46,7 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
if( ( s = strchr( from, '/' ) ) )
{
- if( ( bud = jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT ) ) )
+ if( ( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) ) )
bud->last_act = time( NULL );
else
*s = 0; /* We need to generate a bare JID now. */
@@ -75,7 +75,7 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
fullmsg = g_string_append( fullmsg, body->text );
if( fullmsg->len > 0 )
- serv_got_im( gc, bud ? bud->bare_jid : from, fullmsg->str, 0, 0, fullmsg->len );
+ serv_got_im( ic, bud ? bud->bare_jid : from, fullmsg->str, 0, 0, fullmsg->len );
g_string_free( fullmsg, TRUE );
@@ -83,18 +83,18 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
if( xt_find_node( node->children, "composing" ) )
{
bud->flags |= JBFLAG_DOES_XEP85;
- serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 1 );
+ serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 1 );
}
/* No need to send a "stopped typing" signal when there's a message. */
else if( xt_find_node( node->children, "active" ) && ( body == NULL ) )
{
bud->flags |= JBFLAG_DOES_XEP85;
- serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 0 );
+ serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 0 );
}
else if( xt_find_node( node->children, "paused" ) )
{
bud->flags |= JBFLAG_DOES_XEP85;
- serv_got_typing( gc, bud ? bud->bare_jid : from, 0, 2 );
+ serv_got_typing( ic, bud ? bud->bare_jid : from, 0, 2 );
}
if( s )
diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c
index 2e6b41ab..2db32fd1 100644
--- a/protocols/jabber/presence.c
+++ b/protocols/jabber/presence.c
@@ -25,7 +25,7 @@
xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
char *from = xt_find_attr( node, "from" );
char *type = xt_find_attr( node, "type" ); /* NULL should mean the person is online. */
struct xt_node *c;
@@ -37,10 +37,10 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
if( type == NULL )
{
- if( !( bud = jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) )
+ if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) )
{
- if( set_getbool( &gc->irc->set, "debug" ) )
- serv_got_crap( gc, "WARNING: Could not handle presence information from JID: %s", from );
+ if( set_getbool( &ic->irc->set, "debug" ) )
+ serv_got_crap( ic, "WARNING: Could not handle presence information from JID: %s", from );
return XT_HANDLED;
}
@@ -65,19 +65,19 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
else
bud->priority = 0;
- serv_got_update( gc, bud->bare_jid, 1, 0, 0, 0,
+ serv_got_update( ic, bud->bare_jid, 1, 0, 0, 0,
bud->away_state ? UC_UNAVAILABLE : 0, 0 );
}
else if( strcmp( type, "unavailable" ) == 0 )
{
- if( jabber_buddy_by_jid( gc, from, GET_BUDDY_EXACT ) == NULL )
+ if( jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) == NULL )
{
- if( set_getbool( &gc->irc->set, "debug" ) )
- serv_got_crap( gc, "WARNING: Received presence information from unknown JID: %s", from );
+ if( set_getbool( &ic->irc->set, "debug" ) )
+ serv_got_crap( ic, "WARNING: Received presence information from unknown JID: %s", from );
return XT_HANDLED;
}
- jabber_buddy_remove( gc, from );
+ jabber_buddy_remove( ic, from );
if( ( s = strchr( from, '/' ) ) )
{
@@ -85,24 +85,24 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
/* Only count this as offline if there's no other resource
available anymore. */
- if( jabber_buddy_by_jid( gc, from, 0 ) == NULL )
- serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
+ if( jabber_buddy_by_jid( ic, from, 0 ) == NULL )
+ serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 );
*s = '/';
}
else
{
- serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
+ serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 );
}
}
else if( strcmp( type, "subscribe" ) == 0 )
{
- jabber_buddy_ask( gc, from );
+ jabber_buddy_ask( ic, from );
}
else if( strcmp( type, "subscribed" ) == 0 )
{
/* Not sure about this one, actually... */
- serv_got_crap( gc, "%s just accepted your authorization request", from );
+ serv_got_crap( ic, "%s just accepted your authorization request", from );
}
else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 )
{
@@ -130,29 +130,29 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
/* Whenever presence information is updated, call this function to inform the
server. */
-int presence_send_update( struct gaim_connection *gc )
+int presence_send_update( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *node;
char *show = jd->away_state->code;
char *status = jd->away_message;
int st;
node = jabber_make_packet( "presence", NULL, NULL, NULL );
- xt_add_child( node, xt_new_node( "priority", set_getstr( &gc->acc->set, "priority" ), NULL ) );
+ xt_add_child( node, xt_new_node( "priority", set_getstr( &ic->acc->set, "priority" ), NULL ) );
if( show && *show )
xt_add_child( node, xt_new_node( "show", show, NULL ) );
if( status )
xt_add_child( node, xt_new_node( "status", status, NULL ) );
- st = jabber_write_packet( gc, node );
+ st = jabber_write_packet( ic, node );
xt_free_node( node );
return st;
}
/* Send a subscribe/unsubscribe request to a buddy. */
-int presence_send_request( struct gaim_connection *gc, char *handle, char *request )
+int presence_send_request( struct im_connection *ic, char *handle, char *request )
{
struct xt_node *node;
int st;
@@ -161,7 +161,7 @@ int presence_send_request( struct gaim_connection *gc, char *handle, char *reque
xt_add_attr( node, "to", handle );
xt_add_attr( node, "type", request );
- st = jabber_write_packet( gc, node );
+ st = jabber_write_packet( ic, node );
xt_free_node( node );
return st;
diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c
index 68953ced..4943f59e 100644
--- a/protocols/jabber/sasl.c
+++ b/protocols/jabber/sasl.c
@@ -26,25 +26,25 @@
xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *c, *reply;
char *s;
int sup_plain = 0, sup_digest = 0;
- if( !sasl_supported( gc ) )
+ if( !sasl_supported( ic ) )
{
/* Should abort this now, since we should already be doing
IQ authentication. Strange things happen when you try
to do both... */
- serv_got_crap( gc, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
+ serv_got_crap( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
return XT_HANDLED;
}
s = xt_find_attr( node, "xmlns" );
if( !s || strcmp( s, XMLNS_SASL ) != 0 )
{
- signoff( gc );
+ signoff( ic );
return XT_ABORT;
}
@@ -61,8 +61,8 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
if( !sup_plain && !sup_digest )
{
- hide_login_progress( gc, "No known SASL authentication schemes supported" );
- signoff( gc );
+ hide_login_progress( ic, "No known SASL authentication schemes supported" );
+ signoff( ic );
return XT_ABORT;
}
@@ -82,17 +82,17 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data )
xt_add_attr( reply, "mechanism", "PLAIN" );
/* With SASL PLAIN in XMPP, the text should be b64(\0user\0pass) */
- len = strlen( jd->username ) + strlen( gc->acc->pass ) + 2;
+ len = strlen( jd->username ) + strlen( ic->acc->pass ) + 2;
s = g_malloc( len + 1 );
s[0] = 0;
strcpy( s + 1, jd->username );
- strcpy( s + 2 + strlen( jd->username ), gc->acc->pass );
+ strcpy( s + 2 + strlen( jd->username ), ic->acc->pass );
reply->text = base64_encode( s, len );
reply->text_len = strlen( reply->text );
g_free( s );
}
- if( !jabber_write_packet( gc, reply ) )
+ if( !jabber_write_packet( ic, reply ) )
{
xt_free_node( reply );
return XT_ABORT;
@@ -180,8 +180,8 @@ static char *sasl_get_part( char *data, char *field )
xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
struct xt_node *reply = NULL;
char *nonce = NULL, *realm = NULL, *cnonce = NULL, cnonce_bin[30];
char *digest_uri = NULL;
@@ -221,7 +221,7 @@ xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )
/* Generate the MD5 hash of username:realm:password,
I decided to call it H. */
md5_init( &H );
- s = g_strdup_printf( "%s:%s:%s", jd->username, realm, gc->acc->pass );
+ s = g_strdup_printf( "%s:%s:%s", jd->username, realm, ic->acc->pass );
md5_append( &H, (unsigned char *) s, strlen( s ) );
g_free( s );
md5_finish( &H, Hr );
@@ -271,15 +271,15 @@ xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )
reply = xt_new_node( "response", s, NULL );
xt_add_attr( reply, "xmlns", XMLNS_SASL );
- if( !jabber_write_packet( gc, reply ) )
+ if( !jabber_write_packet( ic, reply ) )
goto silent_error;
ret = XT_HANDLED;
goto silent_error;
error:
- hide_login_progress( gc, "Incorrect SASL challenge received" );
- signoff( gc );
+ hide_login_progress( ic, "Incorrect SASL challenge received" );
+ signoff( ic );
silent_error:
g_free( digest_uri );
@@ -295,26 +295,26 @@ silent_error:
xt_status sasl_pkt_result( struct xt_node *node, gpointer data )
{
- struct gaim_connection *gc = data;
- struct jabber_data *jd = gc->proto_data;
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
char *s;
s = xt_find_attr( node, "xmlns" );
if( !s || strcmp( s, XMLNS_SASL ) != 0 )
{
- signoff( gc );
+ signoff( ic );
return XT_ABORT;
}
if( strcmp( node->name, "success" ) == 0 )
{
- set_login_progress( gc, 1, "Authentication finished" );
+ set_login_progress( ic, 1, "Authentication finished" );
jd->flags |= JFLAG_AUTHENTICATED | JFLAG_STREAM_RESTART;
}
else if( strcmp( node->name, "failure" ) == 0 )
{
- hide_login_progress( gc, "Authentication failure" );
- signoff( gc );
+ hide_login_progress( ic, "Authentication failure" );
+ signoff( ic );
return XT_ABORT;
}
@@ -324,9 +324,9 @@ xt_status sasl_pkt_result( struct xt_node *node, gpointer data )
/* This one is needed to judge if we'll do authentication using IQ or SASL.
It's done by checking if the <stream:stream> from the server has a
version attribute. I don't know if this is the right way though... */
-gboolean sasl_supported( struct gaim_connection *gc )
+gboolean sasl_supported( struct im_connection *ic )
{
- struct jabber_data *jd = gc->proto_data;
+ struct jabber_data *jd = ic->proto_data;
return ( (void*) ( jd->xt && jd->xt->root && xt_find_attr( jd->xt->root, "version" ) ) ) != NULL;
}
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index a73d85d4..afc90627 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -28,7 +28,7 @@
static char *msn_set_display_name( set_t *set, char *value );
-static void msn_acc_init( account_t *acc )
+static void msn_init( account_t *acc )
{
set_t *s;
@@ -38,38 +38,38 @@ static void msn_acc_init( account_t *acc )
static void msn_login( account_t *acc )
{
- struct gaim_connection *gc = new_gaim_conn( acc );
+ struct im_connection *ic = new_gaim_conn( acc );
struct msn_data *md = g_new0( struct msn_data, 1 );
- gc->proto_data = md;
+ ic->proto_data = md;
md->fd = -1;
if( strchr( acc->user, '@' ) == NULL )
{
- hide_login_progress( gc, "Invalid account name" );
- signoff( gc );
+ hide_login_progress( ic, "Invalid account name" );
+ signoff( ic );
return;
}
- set_login_progress( gc, 1, "Connecting" );
+ set_login_progress( ic, 1, "Connecting" );
- md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, gc );
+ md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, ic );
if( md->fd < 0 )
{
- hide_login_progress( gc, "Could not connect to server" );
- signoff( gc );
+ hide_login_progress( ic, "Could not connect to server" );
+ signoff( ic );
return;
}
- md->gc = gc;
+ md->ic = ic;
md->away_state = msn_away_state_list;
- msn_connections = g_slist_append( msn_connections, gc );
+ msn_connections = g_slist_append( msn_connections, ic );
}
-static void msn_close( struct gaim_connection *gc )
+static void msn_logout( struct im_connection *ic )
{
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
GSList *l;
if( md )
@@ -95,7 +95,7 @@ static void msn_close( struct gaim_connection *gc )
{
m = l->data;
- serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
+ serv_got_crap( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
g_free( m->who );
g_free( m->text );
g_free( m );
@@ -110,23 +110,23 @@ static void msn_close( struct gaim_connection *gc )
g_free( md );
}
- for( l = gc->permit; l; l = l->next )
+ for( l = ic->permit; l; l = l->next )
g_free( l->data );
- g_slist_free( gc->permit );
+ g_slist_free( ic->permit );
- for( l = gc->deny; l; l = l->next )
+ for( l = ic->deny; l; l = l->next )
g_free( l->data );
- g_slist_free( gc->deny );
+ g_slist_free( ic->deny );
- msn_connections = g_slist_remove( msn_connections, gc );
+ msn_connections = g_slist_remove( msn_connections, ic );
}
-static int msn_send_im( struct gaim_connection *gc, char *who, char *message, int len, int away )
+static int msn_send_im( struct im_connection *ic, char *who, char *message, int away )
{
struct msn_switchboard *sb;
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
- if( ( sb = msn_sb_by_handle( gc, who ) ) )
+ if( ( sb = msn_sb_by_handle( ic, who ) ) )
{
return( msn_sb_sendmessage( sb, message ) );
}
@@ -141,7 +141,7 @@ static int msn_send_im( struct gaim_connection *gc, char *who, char *message, in
m->text = g_strdup( message );
/* FIXME: *CHECK* the reliability of using spare sb's! */
- if( ( sb = msn_sb_spare( gc ) ) )
+ if( ( sb = msn_sb_spare( ic ) ) )
{
debug( "Trying to use a spare switchboard to message %s", who );
@@ -159,7 +159,7 @@ static int msn_send_im( struct gaim_connection *gc, char *who, char *message, in
/* If we reach this line, there was no spare switchboard, so let's make one. */
g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
- if( !msn_write( gc, buf, strlen( buf ) ) )
+ if( !msn_write( ic, buf, strlen( buf ) ) )
{
g_free( m->who );
g_free( m->text );
@@ -179,7 +179,7 @@ static int msn_send_im( struct gaim_connection *gc, char *who, char *message, in
return( 0 );
}
-static GList *msn_away_states( struct gaim_connection *gc )
+static GList *msn_away_states( struct im_connection *ic )
{
static GList *l = NULL;
int i;
@@ -191,7 +191,7 @@ static GList *msn_away_states( struct gaim_connection *gc )
return l;
}
-static char *msn_get_status_string( struct gaim_connection *gc, int number )
+static char *msn_get_status_string( struct im_connection *ic, int number )
{
const struct msn_away_state *st = msn_away_state_by_number( number );
@@ -201,10 +201,10 @@ static char *msn_get_status_string( struct gaim_connection *gc, int number )
return( "" );
}
-static void msn_set_away( struct gaim_connection *gc, char *state, char *message )
+static void msn_set_away( struct im_connection *ic, char *state, char *message )
{
char buf[1024];
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
const struct msn_away_state *st;
if( strcmp( state, GAIM_AWAY_CUSTOM ) == 0 )
@@ -216,41 +216,41 @@ static void msn_set_away( struct gaim_connection *gc, char *state, char *message
md->away_state = st;
g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, st->code );
- msn_write( gc, buf, strlen( buf ) );
+ msn_write( ic, buf, strlen( buf ) );
}
-static void msn_set_info( struct gaim_connection *gc, char *info )
+static void msn_set_my_name( struct im_connection *ic, char *info )
{
- msn_set_display_name( set_find( &gc->acc->set, "display_name" ), info );
+ msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
}
-static void msn_get_info(struct gaim_connection *gc, char *who)
+static void msn_get_info(struct im_connection *ic, char *who)
{
/* Just make an URL and let the user fetch the info */
- serv_got_crap( gc, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
+ serv_got_crap( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
}
-static void msn_add_buddy( struct gaim_connection *gc, char *who )
+static void msn_add_buddy( struct im_connection *ic, char *who, char *group )
{
- msn_buddy_list_add( gc, "FL", who, who );
+ msn_buddy_list_add( ic, "FL", who, who );
}
-static void msn_remove_buddy( struct gaim_connection *gc, char *who, char *group )
+static void msn_remove_buddy( struct im_connection *ic, char *who, char *group )
{
- msn_buddy_list_remove( gc, "FL", who );
+ msn_buddy_list_remove( ic, "FL", who );
}
-static int msn_chat_send( struct conversation *c, char *message )
+static void msn_chat_send( struct groupchat *c, char *message, int flags )
{
struct msn_switchboard *sb = msn_sb_by_chat( c );
if( sb )
- return( msn_sb_sendmessage( sb, message ) );
- else
- return( 0 );
+ msn_sb_sendmessage( sb, message );
+ /* FIXME: Error handling (although this can't happen unless something's
+ already severely broken) disappeared here! */
}
-static void msn_chat_invite( struct conversation *c, char *msg, char *who )
+static void msn_chat_invite( struct groupchat *c, char *msg, char *who )
{
struct msn_switchboard *sb = msn_sb_by_chat( c );
char buf[1024];
@@ -262,7 +262,7 @@ static void msn_chat_invite( struct conversation *c, char *msg, char *who )
}
}
-static void msn_chat_leave( struct conversation *c )
+static void msn_chat_leave( struct groupchat *c )
{
struct msn_switchboard *sb = msn_sb_by_chat( c );
@@ -270,13 +270,13 @@ static void msn_chat_leave( struct conversation *c )
msn_sb_write( sb, "OUT\r\n", 5 );
}
-static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who )
+static struct groupchat *msn_chat_with( struct im_connection *ic, char *who )
{
struct msn_switchboard *sb;
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
char buf[1024];
- if( ( sb = msn_sb_by_handle( gc, who ) ) )
+ if( ( sb = msn_sb_by_handle( ic, who ) ) )
{
debug( "Converting existing switchboard to %s to a groupchat", who );
return msn_sb_to_chat( sb );
@@ -285,7 +285,7 @@ static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who
{
struct msn_message *m;
- if( ( sb = msn_sb_spare( gc ) ) )
+ if( ( sb = msn_sb_spare( ic ) ) )
{
debug( "Trying to reuse an existing switchboard as a groupchat with %s", who );
g_snprintf( buf, sizeof( buf ), "CAL %d %s\r\n", ++sb->trId, who );
@@ -298,7 +298,7 @@ static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who
/* Request a new switchboard. */
g_snprintf( buf, sizeof( buf ), "XFR %d SB\r\n", ++md->trId );
- if( !msn_write( gc, buf, strlen( buf ) ) )
+ if( !msn_write( ic, buf, strlen( buf ) ) )
return( 0 );
/* Create a magic message. This is quite hackish, but who cares? :-P */
@@ -316,43 +316,43 @@ static struct conversation *msn_chat_open( struct gaim_connection *gc, char *who
return NULL;
}
-static void msn_keepalive( struct gaim_connection *gc )
+static void msn_keepalive( struct im_connection *ic )
{
- msn_write( gc, "PNG\r\n", strlen( "PNG\r\n" ) );
+ msn_write( ic, "PNG\r\n", strlen( "PNG\r\n" ) );
}
-static void msn_add_permit( struct gaim_connection *gc, char *who )
+static void msn_add_permit( struct im_connection *ic, char *who )
{
- msn_buddy_list_add( gc, "AL", who, who );
+ msn_buddy_list_add( ic, "AL", who, who );
}
-static void msn_rem_permit( struct gaim_connection *gc, char *who )
+static void msn_rem_permit( struct im_connection *ic, char *who )
{
- msn_buddy_list_remove( gc, "AL", who );
+ msn_buddy_list_remove( ic, "AL", who );
}
-static void msn_add_deny( struct gaim_connection *gc, char *who )
+static void msn_add_deny( struct im_connection *ic, char *who )
{
struct msn_switchboard *sb;
- msn_buddy_list_add( gc, "BL", who, who );
+ msn_buddy_list_add( ic, "BL", who, who );
/* If there's still a conversation with this person, close it. */
- if( ( sb = msn_sb_by_handle( gc, who ) ) )
+ if( ( sb = msn_sb_by_handle( ic, who ) ) )
{
msn_sb_destroy( sb );
}
}
-static void msn_rem_deny( struct gaim_connection *gc, char *who )
+static void msn_rem_deny( struct im_connection *ic, char *who )
{
- msn_buddy_list_remove( gc, "BL", who );
+ msn_buddy_list_remove( ic, "BL", who );
}
-static int msn_send_typing( struct gaim_connection *gc, char *who, int typing )
+static int msn_send_typing( struct im_connection *ic, char *who, int typing )
{
if( typing )
- return( msn_send_im( gc, who, TYPING_NOTIFICATION_MESSAGE, strlen( TYPING_NOTIFICATION_MESSAGE ), 0 ) );
+ return( msn_send_im( ic, who, TYPING_NOTIFICATION_MESSAGE, 0 ) );
else
return( 1 );
}
@@ -360,26 +360,26 @@ static int msn_send_typing( struct gaim_connection *gc, char *who, int typing )
static char *msn_set_display_name( set_t *set, char *value )
{
account_t *acc = set->data;
- struct gaim_connection *gc = acc->gc;
+ struct im_connection *ic = acc->ic;
struct msn_data *md;
char buf[1024], *fn;
/* Double-check. */
- if( gc == NULL )
+ if( ic == NULL )
return NULL;
- md = gc->proto_data;
+ md = ic->proto_data;
if( strlen( value ) > 129 )
{
- serv_got_crap( gc, "Maximum name length exceeded" );
+ serv_got_crap( ic, "Maximum name length exceeded" );
return NULL;
}
fn = msn_http_encode( value );
- g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn );
- msn_write( gc, buf, strlen( buf ) );
+ g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->username, fn );
+ msn_write( ic, buf, strlen( buf ) );
g_free( fn );
/* Returning NULL would be better, because the server still has to
@@ -388,26 +388,26 @@ static char *msn_set_display_name( set_t *set, char *value )
return value;
}
-void msn_init()
+void msn_initmodule()
{
struct prpl *ret = g_new0(struct prpl, 1);
ret->name = "msn";
ret->login = msn_login;
- ret->acc_init = msn_acc_init;
- ret->close = msn_close;
+ ret->init = msn_init;
+ ret->logout = msn_logout;
ret->send_im = msn_send_im;
ret->away_states = msn_away_states;
ret->get_status_string = msn_get_status_string;
ret->set_away = msn_set_away;
- ret->set_info = msn_set_info;
ret->get_info = msn_get_info;
+ ret->set_my_name = msn_set_my_name;
ret->add_buddy = msn_add_buddy;
ret->remove_buddy = msn_remove_buddy;
ret->chat_send = msn_chat_send;
ret->chat_invite = msn_chat_invite;
ret->chat_leave = msn_chat_leave;
- ret->chat_open = msn_chat_open;
+ ret->chat_with = msn_chat_with;
ret->keepalive = msn_keepalive;
ret->add_permit = msn_add_permit;
ret->rem_permit = msn_rem_permit;
diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h
index 78cc3caf..721466d6 100644
--- a/protocols/msn/msn.h
+++ b/protocols/msn/msn.h
@@ -56,7 +56,7 @@
struct msn_data
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
int fd;
struct msn_handler_data *handler;
@@ -74,7 +74,7 @@ struct msn_data
struct msn_switchboard
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
int fd;
gint inp;
@@ -88,7 +88,7 @@ struct msn_switchboard
GSList *msgq;
char *who;
- struct conversation *chat;
+ struct groupchat *chat;
};
struct msn_away_state
@@ -148,11 +148,11 @@ GSList *msn_switchboards;
gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond );
/* msn_util.c */
-int msn_write( struct gaim_connection *gc, char *s, int len );
-int msn_logged_in( struct gaim_connection *gc );
-int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname );
-int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who );
-void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname );
+int msn_write( struct im_connection *ic, char *s, int len );
+int msn_logged_in( struct im_connection *ic );
+int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname );
+int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who );
+void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
char *msn_findheader( char *text, char *header, int len );
char **msn_linesplit( char *line );
int msn_handler( struct msn_handler_data *h );
@@ -166,11 +166,11 @@ const struct msn_status_code *msn_status_by_number( int number );
/* sb.c */
int msn_sb_write( struct msn_switchboard *sb, char *s, int len );
-struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session );
-struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle );
-struct msn_switchboard *msn_sb_by_chat( struct conversation *c );
-struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc );
+struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session );
+struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle );
+struct msn_switchboard *msn_sb_by_chat( struct groupchat *c );
+struct msn_switchboard *msn_sb_spare( struct im_connection *ic );
int msn_sb_sendmessage( struct msn_switchboard *sb, char *text );
-struct conversation *msn_sb_to_chat( struct msn_switchboard *sb );
+struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb );
void msn_sb_destroy( struct msn_switchboard *sb );
gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c
index ff4c148c..1be1586c 100644
--- a/protocols/msn/msn_util.c
+++ b/protocols/msn/msn_util.c
@@ -27,38 +27,38 @@
#include "msn.h"
#include <ctype.h>
-int msn_write( struct gaim_connection *gc, char *s, int len )
+int msn_write( struct im_connection *ic, char *s, int len )
{
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
int st;
st = write( md->fd, s, len );
if( st != len )
{
- hide_login_progress_error( gc, "Short write() to main server" );
- signoff( gc );
+ hide_login_progress_error( ic, "Short write() to main server" );
+ signoff( ic );
return( 0 );
}
return( 1 );
}
-int msn_logged_in( struct gaim_connection *gc )
+int msn_logged_in( struct im_connection *ic )
{
- account_online( gc );
+ account_online( ic );
return( 0 );
}
-int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char *realname_ )
+int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname_ )
{
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
char buf[1024], *realname;
realname = msn_http_encode( realname_ );
g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname );
- if( msn_write( gc, buf, strlen( buf ) ) )
+ if( msn_write( ic, buf, strlen( buf ) ) )
{
g_free( realname );
@@ -70,13 +70,13 @@ int msn_buddy_list_add( struct gaim_connection *gc, char *list, char *who, char
return( 0 );
}
-int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who )
+int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who )
{
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
char buf[1024];
g_snprintf( buf, sizeof( buf ), "REM %d %s %s\r\n", ++md->trId, list, who );
- if( msn_write( gc, buf, strlen( buf ) ) )
+ if( msn_write( ic, buf, strlen( buf ) ) )
return( 1 );
return( 0 );
@@ -84,17 +84,17 @@ int msn_buddy_list_remove( struct gaim_connection *gc, char *list, char *who )
struct msn_buddy_ask_data
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
char *handle;
char *realname;
};
static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla )
{
- msn_buddy_list_add( bla->gc, "AL", bla->handle, bla->realname );
+ msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname );
- if( find_buddy( bla->gc, bla->handle ) == NULL )
- show_got_added( bla->gc, bla->handle, NULL );
+ if( find_buddy( bla->ic, bla->handle ) == NULL )
+ show_got_added( bla->ic, bla->handle, NULL );
g_free( bla->handle );
g_free( bla->realname );
@@ -103,26 +103,26 @@ static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla )
static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla )
{
- msn_buddy_list_add( bla->gc, "BL", bla->handle, bla->realname );
+ msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname );
g_free( bla->handle );
g_free( bla->realname );
g_free( bla );
}
-void msn_buddy_ask( struct gaim_connection *gc, char *handle, char *realname )
+void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname )
{
struct msn_buddy_ask_data *bla = g_new0( struct msn_buddy_ask_data, 1 );
char buf[1024];
- bla->gc = gc;
+ bla->ic = ic;
bla->handle = g_strdup( handle );
bla->realname = g_strdup( realname );
g_snprintf( buf, sizeof( buf ),
"The user %s (%s) wants to add you to his/her buddy list.",
handle, realname );
- do_ask_dialog( gc, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
+ do_ask_dialog( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
}
char *msn_findheader( char *text, char *header, int len )
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index 9774f3e2..9d86a68e 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -37,26 +37,26 @@ static void msn_auth_got_passport_id( struct passport_reply *rep );
gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
struct msn_data *md;
char s[1024];
- if( !g_slist_find( msn_connections, gc ) )
+ if( !g_slist_find( msn_connections, ic ) )
return FALSE;
if( source == -1 )
{
- hide_login_progress( gc, "Could not connect to server" );
- signoff( gc );
+ hide_login_progress( ic, "Could not connect to server" );
+ signoff( ic );
return FALSE;
}
- md = gc->proto_data;
+ md = ic->proto_data;
if( !md->handler )
{
md->handler = g_new0( struct msn_handler_data, 1 );
- md->handler->data = gc;
+ md->handler->data = ic;
md->handler->exec_command = msn_ns_command;
md->handler->exec_message = msn_ns_message;
}
@@ -72,10 +72,10 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
md->handler->rxq = g_new0( char, 1 );
g_snprintf( s, sizeof( s ), "VER %d MSNP8 CVR0\r\n", ++md->trId );
- if( msn_write( gc, s, strlen( s ) ) )
+ if( msn_write( ic, s, strlen( s ) ) )
{
- gc->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, gc );
- set_login_progress( gc, 1, "Connected to server, waiting for reply" );
+ ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
+ set_login_progress( ic, 1, "Connected to server, waiting for reply" );
}
return FALSE;
@@ -83,13 +83,13 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond )
static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond )
{
- struct gaim_connection *gc = data;
- struct msn_data *md = gc->proto_data;
+ struct im_connection *ic = data;
+ struct msn_data *md = ic->proto_data;
if( msn_handler( md->handler ) == -1 ) /* Don't do this on ret == 0, it's already done then. */
{
- hide_login_progress( gc, "Error while reading from server" );
- signoff( gc );
+ hide_login_progress( ic, "Error while reading from server" );
+ signoff( ic );
return FALSE;
}
@@ -99,8 +99,8 @@ static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition c
static int msn_ns_command( gpointer data, char **cmd, int num_parts )
{
- struct gaim_connection *gc = data;
- struct msn_data *md = gc->proto_data;
+ struct im_connection *ic = data;
+ struct msn_data *md = ic->proto_data;
char buf[1024];
if( num_parts == 0 )
@@ -113,20 +113,20 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
{
if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 )
{
- hide_login_progress( gc, "Unsupported protocol" );
- signoff( gc );
+ hide_login_progress( ic, "Unsupported protocol" );
+ signoff( ic );
return( 0 );
}
g_snprintf( buf, sizeof( buf ), "CVR %d 0x0409 mac 10.2.0 ppc macmsgs 3.5.1 macmsgs %s\r\n",
- ++md->trId, gc->username );
- return( msn_write( gc, buf, strlen( buf ) ) );
+ ++md->trId, ic->username );
+ return( msn_write( ic, buf, strlen( buf ) ) );
}
else if( strcmp( cmd[0], "CVR" ) == 0 )
{
/* We don't give a damn about the information we just received */
- g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, gc->username );
- return( msn_write( gc, buf, strlen( buf ) ) );
+ g_snprintf( buf, sizeof( buf ), "USR %d TWN I %s\r\n", ++md->trId, ic->username );
+ return( msn_write( ic, buf, strlen( buf ) ) );
}
else if( strcmp( cmd[0], "XFR" ) == 0 )
{
@@ -135,24 +135,24 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts == 6 && strcmp( cmd[2], "NS" ) == 0 )
{
- b_event_remove( gc->inpa );
- gc->inpa = 0;
+ b_event_remove( ic->inpa );
+ ic->inpa = 0;
closesocket( md->fd );
server = strchr( cmd[3], ':' );
if( !server )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
*server = 0;
port = atoi( server + 1 );
server = cmd[3];
- set_login_progress( gc, 1, "Transferring to other server" );
+ set_login_progress( ic, 1, "Transferring to other server" );
- md->fd = proxy_connect( server, port, msn_ns_connected, gc );
+ md->fd = proxy_connect( server, port, msn_ns_connected, ic );
}
else if( num_parts == 6 && strcmp( cmd[2], "SB" ) == 0 )
{
@@ -161,8 +161,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
server = strchr( cmd[3], ':' );
if( !server )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
*server = 0;
@@ -171,13 +171,13 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( strcmp( cmd[4], "CKI" ) != 0 )
{
- hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
- signoff( gc );
+ hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
+ signoff( ic );
return( 0 );
}
debug( "Connecting to a new switchboard with key %s", cmd[5] );
- sb = msn_sb_create( gc, server, port, cmd[5], MSN_SB_NEW );
+ sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW );
if( md->msgq )
{
@@ -203,8 +203,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
}
else
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
}
@@ -213,10 +213,10 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts == 5 && strcmp( cmd[2], "TWN" ) == 0 && strcmp( cmd[3], "S" ) == 0 )
{
/* Time for some Passport black magic... */
- if( !passport_get_id( msn_auth_got_passport_id, gc, gc->username, gc->password, cmd[4] ) )
+ if( !passport_get_id( msn_auth_got_passport_id, ic, ic->username, ic->password, cmd[4] ) )
{
- hide_login_progress_error( gc, "Error while contacting Passport server" );
- signoff( gc );
+ hide_login_progress_error( ic, "Error while contacting Passport server" );
+ signoff( ic );
return( 0 );
}
}
@@ -226,24 +226,24 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
http_decode( cmd[4] );
- strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
- gc->displayname[sizeof(gc->displayname)-1] = 0;
+ strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
+ ic->displayname[sizeof(ic->displayname)-1] = 0;
- if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
+ if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
{
g_free( s->value );
s->value = g_strdup( cmd[4] );
}
- set_login_progress( gc, 1, "Authenticated, getting buddy list" );
+ set_login_progress( ic, 1, "Authenticated, getting buddy list" );
g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId );
- return( msn_write( gc, buf, strlen( buf ) ) );
+ return( msn_write( ic, buf, strlen( buf ) ) );
}
else
{
- hide_login_progress( gc, "Unknown authentication type" );
- signoff( gc );
+ hide_login_progress( ic, "Unknown authentication type" );
+ signoff( ic );
return( 0 );
}
}
@@ -251,8 +251,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
{
if( num_parts != 4 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
@@ -260,8 +260,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( md->handler->msglen <= 0 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
}
@@ -275,14 +275,14 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
md->grouplist = g_new0( char *, md->groupcount );
if( !*cmd[3] || md->buddycount == 0 )
- msn_logged_in( gc );
+ msn_logged_in( ic );
}
else
{
/* Hrrm... This SYN reply doesn't really look like something we expected.
Let's assume everything is okay. */
- msn_logged_in( gc );
+ msn_logged_in( ic );
}
}
else if( strcmp( cmd[0], "LST" ) == 0 )
@@ -291,8 +291,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 4 && num_parts != 5 )
{
- hide_login_progress( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
@@ -307,33 +307,33 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( cmd[4] != NULL && sscanf( cmd[4], "%d", &num ) == 1 )
group = md->grouplist[num];
- add_buddy( gc, group, cmd[1], cmd[2] );
+ add_buddy( ic, group, cmd[1], cmd[2] );
}
if( list & 2 ) /* AL */
{
- gc->permit = g_slist_append( gc->permit, g_strdup( cmd[1] ) );
+ ic->permit = g_slist_append( ic->permit, g_strdup( cmd[1] ) );
}
if( list & 4 ) /* BL */
{
- gc->deny = g_slist_append( gc->deny, g_strdup( cmd[1] ) );
+ ic->deny = g_slist_append( ic->deny, g_strdup( cmd[1] ) );
}
if( list & 8 ) /* RL */
{
if( ( list & 6 ) == 0 )
- msn_buddy_ask( gc, cmd[1], cmd[2] );
+ msn_buddy_ask( ic, cmd[1], cmd[2] );
}
if( --md->buddycount == 0 )
{
- if( gc->flags & OPT_LOGGED_IN )
+ if( ic->flags & OPT_LOGGED_IN )
{
- serv_got_crap( gc, "Successfully transferred to different server" );
+ serv_got_crap( ic, "Successfully transferred to different server" );
g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 );
- return( msn_write( gc, buf, strlen( buf ) ) );
+ return( msn_write( ic, buf, strlen( buf ) ) );
}
else
{
- msn_logged_in( gc );
+ msn_logged_in( ic );
}
}
}
@@ -343,8 +343,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 4 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
@@ -362,8 +362,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 3 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
@@ -376,7 +376,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
for( i = 0; i < 16; i ++ )
g_snprintf( buf + strlen( buf ), 3, "%02x", digest[i] );
- return( msn_write( gc, buf, strlen( buf ) ) );
+ return( msn_write( ic, buf, strlen( buf ) ) );
}
else if( strcmp( cmd[0], "ILN" ) == 0 )
{
@@ -384,13 +384,13 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 6 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
http_decode( cmd[4] );
- serv_buddy_rename( gc, cmd[3], cmd[4] );
+ serv_buddy_rename( ic, cmd[3], cmd[4] );
st = msn_away_state_by_code( cmd[2] );
if( !st )
@@ -399,12 +399,12 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
st = msn_away_state_list;
}
- serv_got_update( gc, cmd[3], 1, 0, 0, 0, st->number, 0 );
+ serv_got_update( ic, cmd[3], 1, 0, 0, 0, st->number, 0 );
}
else if( strcmp( cmd[0], "FLN" ) == 0 )
{
if( cmd[1] )
- serv_got_update( gc, cmd[1], 0, 0, 0, 0, 0, 0 );
+ serv_got_update( ic, cmd[1], 0, 0, 0, 0, 0, 0 );
}
else if( strcmp( cmd[0], "NLN" ) == 0 )
{
@@ -412,13 +412,13 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 5 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
http_decode( cmd[3] );
- serv_buddy_rename( gc, cmd[2], cmd[3] );
+ serv_buddy_rename( ic, cmd[2], cmd[3] );
st = msn_away_state_by_code( cmd[1] );
if( !st )
@@ -427,7 +427,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
st = msn_away_state_list;
}
- serv_got_update( gc, cmd[2], 1, 0, 0, 0, st->number, 0 );
+ serv_got_update( ic, cmd[2], 1, 0, 0, 0, st->number, 0 );
}
else if( strcmp( cmd[0], "RNG" ) == 0 )
{
@@ -437,8 +437,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( num_parts != 7 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
@@ -447,8 +447,8 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
server = strchr( cmd[2], ':' );
if( !server )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
*server = 0;
@@ -457,14 +457,14 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( strcmp( cmd[3], "CKI" ) != 0 )
{
- hide_login_progress_error( gc, "Unknown authentication method for switchboard" );
- signoff( gc );
+ hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
+ signoff( ic );
return( 0 );
}
debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] );
- sb = msn_sb_create( gc, server, port, cmd[4], session );
+ sb = msn_sb_create( ic, server, port, cmd[4], session );
sb->who = g_strdup( cmd[5] );
}
else if( strcmp( cmd[0], "ADD" ) == 0 )
@@ -477,60 +477,60 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
if( strchr( cmd[4], '@' ) == NULL )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
/* We got added by someone. If we don't have this person in permit/deny yet, inform the user. */
- for( l = gc->permit; l; l = l->next )
+ for( l = ic->permit; l; l = l->next )
if( g_strcasecmp( l->data, cmd[4] ) == 0 )
return( 1 );
- for( l = gc->deny; l; l = l->next )
+ for( l = ic->deny; l; l = l->next )
if( g_strcasecmp( l->data, cmd[4] ) == 0 )
return( 1 );
- msn_buddy_ask( gc, cmd[4], cmd[5] );
+ msn_buddy_ask( ic, cmd[4], cmd[5] );
}
}
else if( strcmp( cmd[0], "OUT" ) == 0 )
{
if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 )
{
- hide_login_progress_error( gc, "Someone else logged in with your account" );
- gc->wants_to_die = 1;
+ hide_login_progress_error( ic, "Someone else logged in with your account" );
+ ic->wants_to_die = 1;
}
else if( cmd[1] && strcmp( cmd[1], "SSD" ) == 0 )
{
- hide_login_progress_error( gc, "Terminating session because of server shutdown" );
+ hide_login_progress_error( ic, "Terminating session because of server shutdown" );
}
else
{
- hide_login_progress_error( gc, "Session terminated by remote server (reason unknown)" );
+ hide_login_progress_error( ic, "Session terminated by remote server (reason unknown)" );
}
- signoff( gc );
+ signoff( ic );
return( 0 );
}
else if( strcmp( cmd[0], "REA" ) == 0 )
{
if( num_parts != 5 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
- if( g_strcasecmp( cmd[3], gc->username ) == 0 )
+ if( g_strcasecmp( cmd[3], ic->username ) == 0 )
{
set_t *s;
http_decode( cmd[4] );
- strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
- gc->displayname[sizeof(gc->displayname)-1] = 0;
+ strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
+ ic->displayname[sizeof(ic->displayname)-1] = 0;
- if( ( s = set_find( &gc->acc->set, "display_name" ) ) )
+ if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
{
g_free( s->value );
s->value = g_strdup( cmd[4] );
@@ -540,19 +540,19 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
{
/* This is not supposed to happen, but let's handle it anyway... */
http_decode( cmd[4] );
- serv_buddy_rename( gc, cmd[3], cmd[4] );
+ serv_buddy_rename( ic, cmd[3], cmd[4] );
}
}
else if( strcmp( cmd[0], "IPG" ) == 0 )
{
- do_error_dialog( gc, "Received IPG command, we don't handle them yet.", "MSN" );
+ do_error_dialog( ic, "Received IPG command, we don't handle them yet.", "MSN" );
md->handler->msglen = atoi( cmd[1] );
if( md->handler->msglen <= 0 )
{
- hide_login_progress_error( gc, "Syntax error" );
- signoff( gc );
+ hide_login_progress_error( ic, "Syntax error" );
+ signoff( ic );
return( 0 );
}
}
@@ -562,11 +562,11 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
const struct msn_status_code *err = msn_status_by_number( num );
g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text );
- do_error_dialog( gc, buf, "MSN" );
+ do_error_dialog( ic, buf, "MSN" );
if( err->flags & STATUS_FATAL )
{
- signoff( gc );
+ signoff( ic );
return( 0 );
}
}
@@ -580,7 +580,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )
static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts )
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
char *body;
int blen = 0;
@@ -616,7 +616,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int
if( mtype && strcmp( mtype, "1" ) == 0 )
{
if( arg1 )
- serv_got_crap( gc, "The server is going down for maintenance in %s minutes.", arg1 );
+ serv_got_crap( ic, "The server is going down for maintenance in %s minutes.", arg1 );
}
if( arg1 ) g_free( arg1 );
@@ -633,7 +633,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int
if( inbox && folders )
{
- serv_got_crap( gc, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
+ serv_got_crap( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
}
}
else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 )
@@ -643,7 +643,7 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int
if( from && fromname )
{
- serv_got_crap( gc, "Received an e-mail message from %s <%s>.", fromname, from );
+ serv_got_crap( ic, "Received an e-mail message from %s <%s>.", fromname, from );
}
}
else if( g_strncasecmp( ct, "text/x-msmsgsactivemailnotification", 35 ) == 0 )
@@ -664,8 +664,8 @@ static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int
static void msn_auth_got_passport_id( struct passport_reply *rep )
{
- struct gaim_connection *gc = rep->data;
- struct msn_data *md = gc->proto_data;
+ struct im_connection *ic = rep->data;
+ struct msn_data *md = ic->proto_data;
char *key = rep->result;
char buf[1024];
@@ -676,14 +676,14 @@ static void msn_auth_got_passport_id( struct passport_reply *rep )
err = g_strdup_printf( "Error during Passport authentication (%s)",
rep->error_string ? rep->error_string : "Unknown error" );
- hide_login_progress( gc, err );
- signoff( gc );
+ hide_login_progress( ic, err );
+ signoff( ic );
g_free( err );
}
else
{
g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );
- msn_write( gc, buf, strlen( buf ) );
+ msn_write( ic, buf, strlen( buf ) );
}
}
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index 8e912273..f9c755a5 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -47,9 +47,9 @@ int msn_sb_write( struct msn_switchboard *sb, char *s, int len )
return( 1 );
}
-struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, int port, char *key, int session )
+struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session )
{
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
struct msn_switchboard *sb = g_new0( struct msn_switchboard, 1 );
sb->fd = proxy_connect( host, port, msn_sb_connected, sb );
@@ -59,7 +59,7 @@ struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, i
return( NULL );
}
- sb->gc = gc;
+ sb->ic = ic;
sb->key = g_strdup( key );
sb->session = session;
@@ -69,9 +69,9 @@ struct msn_switchboard *msn_sb_create( struct gaim_connection *gc, char *host, i
return( sb );
}
-struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *handle )
+struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle )
{
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
struct msn_switchboard *sb;
GSList *l;
@@ -85,9 +85,9 @@ struct msn_switchboard *msn_sb_by_handle( struct gaim_connection *gc, char *hand
return( NULL );
}
-struct msn_switchboard *msn_sb_by_chat( struct conversation *c )
+struct msn_switchboard *msn_sb_by_chat( struct groupchat *c )
{
- struct msn_data *md = c->gc->proto_data;
+ struct msn_data *md = c->ic->proto_data;
struct msn_switchboard *sb;
GSList *l;
@@ -101,9 +101,9 @@ struct msn_switchboard *msn_sb_by_chat( struct conversation *c )
return( NULL );
}
-struct msn_switchboard *msn_sb_spare( struct gaim_connection *gc )
+struct msn_switchboard *msn_sb_spare( struct im_connection *ic )
{
- struct msn_data *md = gc->proto_data;
+ struct msn_data *md = ic->proto_data;
struct msn_switchboard *sb;
GSList *l;
@@ -141,9 +141,9 @@ int msn_sb_sendmessage( struct msn_switchboard *sb, char *text )
}
else
{
- i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->gc->username );
+ i = strlen( MSN_TYPING_HEADERS ) + strlen( sb->ic->username );
buf = g_new0( char, i );
- i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->gc->username );
+ i = g_snprintf( buf, i, MSN_TYPING_HEADERS, sb->ic->username );
}
/* Build the final packet (MSG command + the message). */
@@ -176,18 +176,18 @@ int msn_sb_sendmessage( struct msn_switchboard *sb, char *text )
}
}
-struct conversation *msn_sb_to_chat( struct msn_switchboard *sb )
+struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
{
- struct gaim_connection *gc = sb->gc;
+ struct im_connection *ic = sb->ic;
char buf[1024];
/* Create the groupchat structure. */
g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
- sb->chat = serv_got_joined_chat( gc, buf );
+ sb->chat = serv_got_joined_chat( ic, buf );
/* Populate the channel. */
if( sb->who ) add_chat_buddy( sb->chat, sb->who );
- add_chat_buddy( sb->chat, gc->username );
+ add_chat_buddy( sb->chat, ic->username );
/* And make sure the switchboard doesn't look like a regular chat anymore. */
if( sb->who )
@@ -201,8 +201,8 @@ struct conversation *msn_sb_to_chat( struct msn_switchboard *sb )
void msn_sb_destroy( struct msn_switchboard *sb )
{
- struct gaim_connection *gc = sb->gc;
- struct msn_data *md = gc->proto_data;
+ struct im_connection *ic = sb->ic;
+ struct msn_data *md = ic->proto_data;
debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" );
@@ -221,7 +221,7 @@ void msn_sb_destroy( struct msn_switchboard *sb )
}
g_slist_free( sb->msgq );
- serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with "
+ serv_got_crap( ic, "Warning: Closing down MSN switchboard connection with "
"unsent message to %s, you'll have to resend it.",
sb->who ? sb->who : "(unknown)" );
}
@@ -252,7 +252,7 @@ void msn_sb_destroy( struct msn_switchboard *sb )
gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )
{
struct msn_switchboard *sb = data;
- struct gaim_connection *gc;
+ struct im_connection *ic;
struct msn_data *md;
char buf[1024];
@@ -260,8 +260,8 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )
if( !g_slist_find( msn_switchboards, sb ) )
return FALSE;
- gc = sb->gc;
- md = gc->proto_data;
+ ic = sb->ic;
+ md = ic->proto_data;
if( source != sb->fd )
{
@@ -279,9 +279,9 @@ gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond )
sb->handler->exec_message = msn_sb_message;
if( sb->session == MSN_SB_NEW )
- g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, gc->username, sb->key );
+ g_snprintf( buf, sizeof( buf ), "USR %d %s %s\r\n", ++sb->trId, ic->username, sb->key );
else
- g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, gc->username, sb->key, sb->session );
+ g_snprintf( buf, sizeof( buf ), "ANS %d %s %s %d\r\n", ++sb->trId, ic->username, sb->key, sb->session );
if( msn_sb_write( sb, buf, strlen( buf ) ) )
sb->inp = b_input_add( sb->fd, GAIM_INPUT_READ, msn_sb_callback, sb );
@@ -309,7 +309,7 @@ static gboolean msn_sb_callback( gpointer data, gint source, b_input_condition c
static int msn_sb_command( gpointer data, char **cmd, int num_parts )
{
struct msn_switchboard *sb = data;
- struct gaim_connection *gc = sb->gc;
+ struct im_connection *ic = sb->ic;
char buf[1024];
if( !num_parts )
@@ -320,8 +320,8 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
if( strcmp( cmd[0], "XFR" ) == 0 )
{
- hide_login_progress_error( gc, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
- signoff( gc );
+ hide_login_progress_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
+ signoff( ic );
return( 0 );
}
else if( strcmp( cmd[0], "USR" ) == 0 )
@@ -373,7 +373,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
if( num == 1 )
{
g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
- sb->chat = serv_got_joined_chat( gc, buf );
+ sb->chat = serv_got_joined_chat( ic, buf );
g_free( sb->who );
sb->who = NULL;
@@ -383,7 +383,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
if( num == tot )
{
- add_chat_buddy( sb->chat, gc->username );
+ add_chat_buddy( sb->chat, ic->username );
}
}
}
@@ -528,7 +528,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
const struct msn_status_code *err = msn_status_by_number( num );
g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text );
- do_error_dialog( gc, buf, "MSN" );
+ do_error_dialog( ic, buf, "MSN" );
if( err->flags & STATUS_SB_FATAL )
{
@@ -537,7 +537,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
}
else if( err->flags & STATUS_FATAL )
{
- signoff( gc );
+ signoff( ic );
return 0;
}
else if( err->flags & STATUS_SB_IM_SPARE )
@@ -578,7 +578,7 @@ static int msn_sb_command( gpointer data, char **cmd, int num_parts )
static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts )
{
struct msn_switchboard *sb = data;
- struct gaim_connection *gc = sb->gc;
+ struct im_connection *ic = sb->ic;
char *body;
int blen = 0;
@@ -607,7 +607,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int
if( sb->who )
{
- serv_got_im( gc, cmd[1], body, 0, 0, blen );
+ serv_got_im( ic, cmd[1], body, 0, 0, blen );
}
else if( sb->chat )
{
@@ -666,7 +666,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int
if( sb->who )
{
- serv_got_im( gc, cmd[1], buf, 0, 0, strlen( buf ) );
+ serv_got_im( ic, cmd[1], buf, 0, 0, strlen( buf ) );
}
else if( sb->chat )
{
@@ -683,7 +683,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int
if( who )
{
- serv_got_typing( gc, who, 5, 1 );
+ serv_got_typing( ic, who, 5, 1 );
g_free( who );
}
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index e983352f..987c08f2 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -35,7 +35,7 @@
#include "nogaim.h"
#include <ctype.h>
-static int remove_chat_buddy_silent( struct conversation *b, char *handle );
+static int remove_chat_buddy_silent( struct groupchat *b, char *handle );
GSList *connections;
@@ -114,25 +114,25 @@ struct prpl *find_protocol(const char *name)
/* nogaim.c */
void nogaim_init()
{
- extern void msn_init();
- extern void oscar_init();
- extern void byahoo_init();
- extern void jabber_init();
+ extern void msn_initmodule();
+ extern void oscar_initmodule();
+ extern void byahoo_initmodule();
+ extern void jabber_initmodule();
#ifdef WITH_MSN
- msn_init();
+ msn_initmodule();
#endif
#ifdef WITH_OSCAR
- oscar_init();
+ oscar_initmodule();
#endif
#ifdef WITH_YAHOO
- byahoo_init();
+ byahoo_initmodule();
#endif
#ifdef WITH_JABBER
- jabber_init();
+ jabber_initmodule();
#endif
#ifdef WITH_PLUGINS
@@ -144,59 +144,59 @@ GSList *get_connections() { return connections; }
/* multi.c */
-struct gaim_connection *new_gaim_conn( account_t *acc )
+struct im_connection *new_gaim_conn( account_t *acc )
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
- gc = g_new0( struct gaim_connection, 1 );
+ ic = g_new0( struct im_connection, 1 );
/* Maybe we should get rid of this memory waste later. ;-) */
- g_snprintf( gc->username, sizeof( gc->username ), "%s", acc->user );
- g_snprintf( gc->password, sizeof( gc->password ), "%s", acc->pass );
+ g_snprintf( ic->username, sizeof( ic->username ), "%s", acc->user );
+ g_snprintf( ic->password, sizeof( ic->password ), "%s", acc->pass );
- gc->irc = acc->irc;
- gc->acc = acc;
- acc->gc = gc;
+ ic->irc = acc->irc;
+ ic->acc = acc;
+ acc->ic = ic;
- connections = g_slist_append( connections, gc );
+ connections = g_slist_append( connections, ic );
- return( gc );
+ return( ic );
}
-void destroy_gaim_conn( struct gaim_connection *gc )
+void destroy_gaim_conn( struct im_connection *ic )
{
account_t *a;
/* Destroy the pointer to this connection from the account list */
- for( a = gc->irc->accounts; a; a = a->next )
- if( a->gc == gc )
+ for( a = ic->irc->accounts; a; a = a->next )
+ if( a->ic == ic )
{
- a->gc = NULL;
+ a->ic = NULL;
break;
}
- connections = g_slist_remove( connections, gc );
- g_free( gc );
+ connections = g_slist_remove( connections, ic );
+ g_free( ic );
}
-void set_login_progress( struct gaim_connection *gc, int step, char *msg )
+void set_login_progress( struct im_connection *ic, int step, char *msg )
{
- serv_got_crap( gc, "Logging in: %s", msg );
+ serv_got_crap( ic, "Logging in: %s", msg );
}
/* Errors *while* logging in */
-void hide_login_progress( struct gaim_connection *gc, char *msg )
+void hide_login_progress( struct im_connection *ic, char *msg )
{
- serv_got_crap( gc, "Login error: %s", msg );
+ serv_got_crap( ic, "Login error: %s", msg );
}
/* Errors *after* logging in */
-void hide_login_progress_error( struct gaim_connection *gc, char *msg )
+void hide_login_progress_error( struct im_connection *ic, char *msg )
{
- serv_got_crap( gc, "Logged out: %s", msg );
+ serv_got_crap( ic, "Logged out: %s", msg );
}
-void serv_got_crap( struct gaim_connection *gc, char *format, ... )
+void serv_got_crap( struct im_connection *ic, char *format, ... )
{
va_list params;
char *text;
@@ -206,54 +206,54 @@ void serv_got_crap( struct gaim_connection *gc, char *format, ... )
text = g_strdup_vprintf( format, params );
va_end( params );
- if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
- ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
+ if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
+ ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
strip_html( text );
/* Try to find a different connection on the same protocol. */
- for( a = gc->irc->accounts; a; a = a->next )
- if( a->prpl == gc->acc->prpl && a->gc != gc )
+ for( a = ic->irc->accounts; a; a = a->next )
+ if( a->prpl == ic->acc->prpl && a->ic != ic )
break;
/* If we found one, include the screenname in the message. */
if( a )
- irc_usermsg( gc->irc, "%s(%s) - %s", gc->acc->prpl->name, gc->username, text );
+ irc_usermsg( ic->irc, "%s(%s) - %s", ic->acc->prpl->name, ic->username, text );
else
- irc_usermsg( gc->irc, "%s - %s", gc->acc->prpl->name, text );
+ irc_usermsg( ic->irc, "%s - %s", ic->acc->prpl->name, text );
g_free( text );
}
static gboolean send_keepalive( gpointer d, gint fd, b_input_condition cond )
{
- struct gaim_connection *gc = d;
+ struct im_connection *ic = d;
- if( gc->acc->prpl->keepalive )
- gc->acc->prpl->keepalive( gc );
+ if( ic->acc->prpl->keepalive )
+ ic->acc->prpl->keepalive( ic );
return TRUE;
}
-void account_online( struct gaim_connection *gc )
+void account_online( struct im_connection *ic )
{
user_t *u;
/* MSN servers sometimes redirect you to a different server and do
the whole login sequence again, so these "late" calls to this
function should be handled correctly. (IOW, ignored) */
- if( gc->flags & OPT_LOGGED_IN )
+ if( ic->flags & OPT_LOGGED_IN )
return;
- u = user_find( gc->irc, gc->irc->nick );
+ u = user_find( ic->irc, ic->irc->nick );
- serv_got_crap( gc, "Logged in" );
+ serv_got_crap( ic, "Logged in" );
- gc->keepalive = b_timeout_add( 60000, send_keepalive, gc );
- gc->flags |= OPT_LOGGED_IN;
+ ic->keepalive = b_timeout_add( 60000, send_keepalive, ic );
+ ic->flags |= OPT_LOGGED_IN;
/* Also necessary when we're not away, at least for some of the
protocols. */
- bim_set_away( gc, u->away );
+ bim_set_away( ic, u->away );
}
gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond )
@@ -273,29 +273,29 @@ void cancel_auto_reconnect( account_t *a )
a->reconnect = 0;
}
-void signoff( struct gaim_connection *gc )
+void signoff( struct im_connection *ic )
{
- irc_t *irc = gc->irc;
+ irc_t *irc = ic->irc;
user_t *t, *u = irc->users;
account_t *a;
/* Nested calls might happen sometimes, this is probably the best
place to catch them. */
- if( gc->flags & OPT_LOGGING_OUT )
+ if( ic->flags & OPT_LOGGING_OUT )
return;
else
- gc->flags |= OPT_LOGGING_OUT;
+ ic->flags |= OPT_LOGGING_OUT;
- serv_got_crap( gc, "Signing off.." );
+ serv_got_crap( ic, "Signing off.." );
- b_event_remove( gc->keepalive );
- gc->keepalive = 0;
- gc->acc->prpl->close( gc );
- b_event_remove( gc->inpa );
+ b_event_remove( ic->keepalive );
+ ic->keepalive = 0;
+ ic->acc->prpl->logout( ic );
+ b_event_remove( ic->inpa );
while( u )
{
- if( u->gc == gc )
+ if( u->ic == ic )
{
t = u->next;
user_del( irc, u->nick );
@@ -305,65 +305,65 @@ void signoff( struct gaim_connection *gc )
u = u->next;
}
- query_del_by_gc( gc->irc, gc );
+ query_del_by_conn( ic->irc, ic );
for( a = irc->accounts; a; a = a->next )
- if( a->gc == gc )
+ if( a->ic == ic )
break;
if( !a )
{
/* Uhm... This is very sick. */
}
- else if( !gc->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) &&
+ else if( !ic->wants_to_die && set_getbool( &irc->set, "auto_reconnect" ) &&
set_getbool( &a->set, "auto_reconnect" ) )
{
int delay = set_getint( &irc->set, "auto_reconnect_delay" );
- serv_got_crap( gc, "Reconnecting in %d seconds..", delay );
+ serv_got_crap( ic, "Reconnecting in %d seconds..", delay );
a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a );
}
- destroy_gaim_conn( gc );
+ destroy_gaim_conn( ic );
}
/* dialogs.c */
-void do_error_dialog( struct gaim_connection *gc, char *msg, char *title )
+void do_error_dialog( struct im_connection *ic, char *msg, char *title )
{
if( msg && title )
- serv_got_crap( gc, "Error: %s: %s", title, msg );
+ serv_got_crap( ic, "Error: %s: %s", title, msg );
else if( msg )
- serv_got_crap( gc, "Error: %s", msg );
+ serv_got_crap( ic, "Error: %s", msg );
else if( title )
- serv_got_crap( gc, "Error: %s", title );
+ serv_got_crap( ic, "Error: %s", title );
else
- serv_got_crap( gc, "Error" );
+ serv_got_crap( ic, "Error" );
}
-void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont )
+void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont )
{
- query_add( gc->irc, gc, msg, doit, dont, data );
+ query_add( ic->irc, ic, msg, doit, dont, data );
}
/* list.c */
-void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname )
+void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname )
{
user_t *u;
char nick[MAX_NICK_LENGTH+1];
char *s;
- irc_t *irc = gc->irc;
+ irc_t *irc = ic->irc;
if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */
- serv_got_crap( gc, "Receiving user add from handle: %s", handle );
+ serv_got_crap( ic, "Receiving user add from handle: %s", handle );
- if( user_findhandle( gc, handle ) )
+ if( user_findhandle( ic, handle ) )
{
if( set_getbool( &irc->set, "debug" ) )
- serv_got_crap( gc, "User already exists, ignoring add request: %s", handle );
+ serv_got_crap( ic, "User already exists, ignoring add request: %s", handle );
return;
@@ -371,9 +371,9 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea
}
memset( nick, 0, MAX_NICK_LENGTH + 1 );
- strcpy( nick, nick_get( gc->acc, handle, realname ) );
+ strcpy( nick, nick_get( ic->acc, handle, realname ) );
- u = user_add( gc->irc, nick );
+ u = user_add( ic->irc, nick );
if( !realname || !*realname ) realname = nick;
u->realname = g_strdup( realname );
@@ -383,15 +383,15 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea
u->host = g_strdup( s + 1 );
u->user = g_strndup( handle, s - handle );
}
- else if( gc->acc->server )
+ else if( ic->acc->server )
{
char *colon;
- if( ( colon = strchr( gc->acc->server, ':' ) ) )
- u->host = g_strndup( gc->acc->server,
- colon - gc->acc->server );
+ if( ( colon = strchr( ic->acc->server, ':' ) ) )
+ u->host = g_strndup( ic->acc->server,
+ colon - ic->acc->server );
else
- u->host = g_strdup( gc->acc->server );
+ u->host = g_strdup( ic->acc->server );
u->user = g_strdup( handle );
@@ -402,23 +402,23 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea
}
else
{
- u->host = g_strdup( gc->acc->prpl->name );
+ u->host = g_strdup( ic->acc->prpl->name );
u->user = g_strdup( handle );
}
- u->gc = gc;
+ u->ic = ic;
u->handle = g_strdup( handle );
if( group ) u->group = g_strdup( group );
u->send_handler = buddy_send_handler;
u->last_typing_notice = 0;
}
-struct buddy *find_buddy( struct gaim_connection *gc, char *handle )
+struct buddy *find_buddy( struct im_connection *ic, char *handle )
{
static struct buddy b[1];
user_t *u;
- u = user_findhandle( gc, handle );
+ u = user_findhandle( ic, handle );
if( !u )
return( NULL );
@@ -427,20 +427,20 @@ struct buddy *find_buddy( struct gaim_connection *gc, char *handle )
strncpy( b->name, handle, 80 );
strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN );
b->present = u->online;
- b->gc = u->gc;
+ b->ic = u->ic;
return( b );
}
-void signoff_blocked( struct gaim_connection *gc )
+void signoff_blocked( struct im_connection *ic )
{
return; /* Make all blocked users look invisible (TODO?) */
}
-void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname )
+void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname )
{
- user_t *u = user_findhandle( gc, handle );
+ user_t *u = user_findhandle( ic, handle );
if( !u ) return;
@@ -450,8 +450,8 @@ void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname
u->realname = g_strdup( realname );
- if( ( gc->flags & OPT_LOGGED_IN ) && set_getbool( &gc->irc->set, "display_namechanges" ) )
- serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname );
+ if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )
+ serv_got_crap( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
}
}
@@ -460,7 +460,7 @@ void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname
struct show_got_added_data
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
char *handle;
};
@@ -472,51 +472,51 @@ void show_got_added_no( gpointer w, struct show_got_added_data *data )
void show_got_added_yes( gpointer w, struct show_got_added_data *data )
{
- data->gc->acc->prpl->add_buddy( data->gc, data->handle );
- add_buddy( data->gc, NULL, data->handle, data->handle );
+ data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL );
+ add_buddy( data->ic, NULL, data->handle, data->handle );
return show_got_added_no( w, data );
}
-void show_got_added( struct gaim_connection *gc, char *handle, const char *realname )
+void show_got_added( struct im_connection *ic, char *handle, const char *realname )
{
struct show_got_added_data *data = g_new0( struct show_got_added_data, 1 );
char *s;
/* TODO: Make a setting for this! */
- if( user_findhandle( gc, handle ) != NULL )
+ if( user_findhandle( ic, handle ) != NULL )
return;
s = g_strdup_printf( "The user %s is not in your buddy list yet. Do you want to add him/her now?", handle );
- data->gc = gc;
+ data->ic = ic;
data->handle = g_strdup( handle );
- query_add( gc->irc, gc, s, show_got_added_yes, show_got_added_no, data );
+ query_add( ic->irc, ic, s, show_got_added_yes, show_got_added_no, data );
}
/* server.c */
-void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
+void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps )
{
user_t *u;
int oa, oo;
- u = user_findhandle( gc, handle );
+ u = user_findhandle( ic, handle );
if( !u )
{
- if( g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "add" ) == 0 )
+ if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 )
{
- add_buddy( gc, NULL, handle, NULL );
- u = user_findhandle( gc, handle );
+ add_buddy( ic, NULL, handle, NULL );
+ u = user_findhandle( ic, handle );
}
else
{
- if( set_getbool( &gc->irc->set, "debug" ) || g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "ignore" ) != 0 )
+ if( set_getbool( &ic->irc->set, "debug" ) || g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "ignore" ) != 0 )
{
- serv_got_crap( gc, "serv_got_update() for handle %s:", handle );
- serv_got_crap( gc, "loggedin = %d, type = %d", loggedin, type );
+ serv_got_crap( ic, "serv_got_update() for handle %s:", handle );
+ serv_got_crap( ic, "loggedin = %d, type = %d", loggedin, type );
}
return;
@@ -536,26 +536,26 @@ void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, in
if( loggedin && !u->online )
{
- irc_spawn( gc->irc, u );
+ irc_spawn( ic->irc, u );
u->online = 1;
}
else if( !loggedin && u->online )
{
- struct conversation *c;
+ struct groupchat *c;
- irc_kill( gc->irc, u );
+ irc_kill( ic->irc, u );
u->online = 0;
/* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */
- for( c = gc->conversations; c; c = c->next )
+ for( c = ic->conversations; c; c = c->next )
remove_chat_buddy_silent( c, handle );
}
- if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "oscar" ) == 0 || strcmp( gc->acc->prpl->name, "icq" ) == 0 ) )
+ if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "oscar" ) == 0 || strcmp( ic->acc->prpl->name, "icq" ) == 0 ) )
{
u->away = g_strdup( "Away" );
}
- else if( ( type & UC_UNAVAILABLE ) && ( strcmp( gc->acc->prpl->name, "jabber" ) == 0 ) )
+ else if( ( type & UC_UNAVAILABLE ) && ( strcmp( ic->acc->prpl->name, "jabber" ) == 0 ) )
{
if( type & UC_DND )
u->away = g_strdup( "Do Not Disturb" );
@@ -564,30 +564,30 @@ void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, in
else // if( type & UC_AWAY )
u->away = g_strdup( "Away" );
}
- else if( ( type & UC_UNAVAILABLE ) && gc->acc->prpl->get_status_string )
+ else if( ( type & UC_UNAVAILABLE ) && ic->acc->prpl->get_status_string )
{
- u->away = g_strdup( gc->acc->prpl->get_status_string( gc, type ) );
+ u->away = g_strdup( ic->acc->prpl->get_status_string( ic, type ) );
}
else
u->away = NULL;
/* LISPy... */
- if( ( set_getbool( &gc->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */
+ if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */
( u->online ) && /* Don't touch offline people */
( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */
( ( u->online == oo ) && ( oa == !u->away ) ) ) ) /* (De)voice people changing state */
{
- irc_write( gc->irc, ":%s MODE %s %cv %s", gc->irc->myhost,
- gc->irc->channel, u->away?'-':'+', u->nick );
+ irc_write( ic->irc, ":%s MODE %s %cv %s", ic->irc->myhost,
+ ic->irc->channel, u->away?'-':'+', u->nick );
}
}
-void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len )
+void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len )
{
- irc_t *irc = gc->irc;
+ irc_t *irc = ic->irc;
user_t *u;
- u = user_findhandle( gc, handle );
+ u = user_findhandle( ic, handle );
if( !u )
{
@@ -596,7 +596,7 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
if( g_strcasecmp( h, "ignore" ) == 0 )
{
if( set_getbool( &irc->set, "debug" ) )
- serv_got_crap( gc, "Ignoring message from unknown handle %s", handle );
+ serv_got_crap( ic, "Ignoring message from unknown handle %s", handle );
return;
}
@@ -612,19 +612,19 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
private = 0;
}
- add_buddy( gc, NULL, handle, NULL );
- u = user_findhandle( gc, handle );
+ add_buddy( ic, NULL, handle, NULL );
+ u = user_findhandle( ic, handle );
u->is_private = private;
}
else
{
- serv_got_crap( gc, "Message from unknown handle %s:", handle );
+ serv_got_crap( ic, "Message from unknown handle %s:", handle );
u = user_find( irc, irc->mynick );
}
}
- if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
- ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
+ if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
+ ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
strip_html( msg );
while( strlen( msg ) > 425 )
@@ -660,14 +660,14 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
irc_msgfrom( irc, u->nick, msg );
}
-void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type )
+void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type )
{
user_t *u;
- if( !set_getbool( &gc->irc->set, "typing_notice" ) )
+ if( !set_getbool( &ic->irc->set, "typing_notice" ) )
return;
- if( ( u = user_findhandle( gc, handle ) ) ) {
+ if( ( u = user_findhandle( ic, handle ) ) ) {
/* If type is:
* 0: user has stopped typing
* 1: user is actively typing
@@ -676,19 +676,19 @@ void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int
if (type == 0 || type == 1 || type == 2) {
char buf[256];
g_snprintf(buf, 256, "\1TYPING %d\1", type);
- irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf );
+ irc_privmsg( ic->irc, u, "PRIVMSG", ic->irc->nick, NULL, buf );
}
}
}
-void serv_got_chat_left( struct conversation *c )
+void serv_got_chat_left( struct groupchat *c )
{
- struct gaim_connection *gc = c->gc;
- struct conversation *l = NULL;
+ struct im_connection *ic = c->ic;
+ struct groupchat *l = NULL;
GList *ir;
- if( set_getbool( &gc->irc->set, "debug" ) )
- serv_got_crap( gc, "You were removed from conversation 0x%x", (int) c );
+ if( set_getbool( &ic->irc->set, "debug" ) )
+ serv_got_crap( ic, "You were removed from conversation 0x%x", (int) c );
if( c )
{
@@ -696,18 +696,18 @@ void serv_got_chat_left( struct conversation *c )
{
user_t *u, *r;
- r = user_find( gc->irc, gc->irc->mynick );
- irc_privmsg( gc->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" );
+ r = user_find( ic->irc, ic->irc->mynick );
+ irc_privmsg( ic->irc, r, "PRIVMSG", c->channel, "", "Cleaning up channel, bye!" );
- u = user_find( gc->irc, gc->irc->nick );
- irc_kick( gc->irc, u, c->channel, r );
- /* irc_part( gc->irc, u, c->channel ); */
+ u = user_find( ic->irc, ic->irc->nick );
+ irc_kick( ic->irc, u, c->channel, r );
+ /* irc_part( ic->irc, u, c->channel ); */
}
if( l )
l->next = c->next;
else
- gc->conversations = c->next;
+ ic->conversations = c->next;
for( ir = c->in_room; ir; ir = ir->next )
g_free( ir->data );
@@ -718,47 +718,47 @@ void serv_got_chat_left( struct conversation *c )
}
}
-void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime )
+void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime )
{
- struct gaim_connection *gc = c->gc;
+ struct im_connection *ic = c->ic;
user_t *u;
/* Gaim sends own messages through this too. IRC doesn't want this, so kill them */
- if( g_strcasecmp( who, gc->username ) == 0 )
+ if( g_strcasecmp( who, ic->username ) == 0 )
return;
- u = user_findhandle( gc, who );
+ u = user_findhandle( ic, who );
- if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) ||
- ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) )
+ if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 ) ||
+ ( ( ic->flags & OPT_CONN_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )
strip_html( msg );
if( c && u )
- irc_privmsg( gc->irc, u, "PRIVMSG", c->channel, "", msg );
+ irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", msg );
else
- serv_got_crap( gc, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
+ serv_got_crap( ic, "Message from/to conversation %s@0x%x (unknown conv/user): %s", who, (int) c, msg );
}
-struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle )
+struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle )
{
- struct conversation *c;
+ struct groupchat *c;
/* This one just creates the conversation structure, user won't see anything yet */
- if( gc->conversations )
+ if( ic->conversations )
{
- for( c = gc->conversations; c->next; c = c->next );
- c = c->next = g_new0( struct conversation, 1 );
+ for( c = ic->conversations; c->next; c = c->next );
+ c = c->next = g_new0( struct groupchat, 1 );
}
else
- gc->conversations = c = g_new0( struct conversation, 1 );
+ ic->conversations = c = g_new0( struct groupchat, 1 );
- c->gc = gc;
+ c->ic = ic;
c->title = g_strdup( handle );
- c->channel = g_strdup_printf( "&chat_%03d", gc->irc->c_id++ );
+ c->channel = g_strdup_printf( "&chat_%03d", ic->irc->c_id++ );
- if( set_getbool( &gc->irc->set, "debug" ) )
- serv_got_crap( gc, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
+ if( set_getbool( &ic->irc->set, "debug" ) )
+ serv_got_crap( ic, "Creating new conversation: (id=0x%x,handle=%s)", (int) c, handle );
return c;
}
@@ -766,20 +766,20 @@ struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *han
/* buddy_chat.c */
-void add_chat_buddy( struct conversation *b, char *handle )
+void add_chat_buddy( struct groupchat *b, char *handle )
{
- user_t *u = user_findhandle( b->gc, handle );
+ user_t *u = user_findhandle( b->ic, handle );
int me = 0;
- if( set_getbool( &b->gc->irc->set, "debug" ) )
- serv_got_crap( b->gc, "User %s added to conversation 0x%x", handle, (int) b );
+ if( set_getbool( &b->ic->irc->set, "debug" ) )
+ serv_got_crap( b->ic, "User %s added to conversation 0x%x", handle, (int) b );
/* It might be yourself! */
- if( b->gc->acc->prpl->handle_cmp( handle, b->gc->username ) == 0 )
+ if( b->ic->acc->prpl->handle_cmp( handle, b->ic->username ) == 0 )
{
- u = user_find( b->gc->irc, b->gc->irc->nick );
+ u = user_find( b->ic->irc, b->ic->irc->nick );
if( !b->joined )
- irc_join( b->gc->irc, u, b->channel );
+ irc_join( b->ic->irc, u, b->channel );
b->joined = me = 1;
}
@@ -787,45 +787,45 @@ void add_chat_buddy( struct conversation *b, char *handle )
your contact list. Try to handle that here */
if( !u )
{
- add_buddy( b->gc, NULL, handle, NULL );
- u = user_findhandle( b->gc, handle );
+ add_buddy( b->ic, NULL, handle, NULL );
+ u = user_findhandle( b->ic, handle );
}
/* Add the handle to the room userlist, if it's not 'me' */
if( !me )
{
if( b->joined )
- irc_join( b->gc->irc, u, b->channel );
+ irc_join( b->ic->irc, u, b->channel );
b->in_room = g_list_append( b->in_room, g_strdup( handle ) );
}
}
-void remove_chat_buddy( struct conversation *b, char *handle, char *reason )
+void remove_chat_buddy( struct groupchat *b, char *handle, char *reason )
{
user_t *u;
int me = 0;
- if( set_getbool( &b->gc->irc->set, "debug" ) )
- serv_got_crap( b->gc, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
+ if( set_getbool( &b->ic->irc->set, "debug" ) )
+ serv_got_crap( b->ic, "User %s removed from conversation 0x%x (%s)", handle, (int) b, reason ? reason : "" );
/* It might be yourself! */
- if( g_strcasecmp( handle, b->gc->username ) == 0 )
+ if( g_strcasecmp( handle, b->ic->username ) == 0 )
{
- u = user_find( b->gc->irc, b->gc->irc->nick );
+ u = user_find( b->ic->irc, b->ic->irc->nick );
b->joined = 0;
me = 1;
}
else
{
- u = user_findhandle( b->gc, handle );
+ u = user_findhandle( b->ic, handle );
}
if( remove_chat_buddy_silent( b, handle ) )
if( ( b->joined || me ) && u )
- irc_part( b->gc->irc, u, b->channel );
+ irc_part( b->ic->irc, u, b->channel );
}
-static int remove_chat_buddy_silent( struct conversation *b, char *handle )
+static int remove_chat_buddy_silent( struct groupchat *b, char *handle )
{
GList *i;
@@ -849,17 +849,17 @@ static int remove_chat_buddy_silent( struct conversation *b, char *handle )
/* Misc. BitlBee stuff which shouldn't really be here */
-struct conversation *chat_by_channel( char *channel )
+struct groupchat *chat_by_channel( char *channel )
{
- struct gaim_connection *gc;
- struct conversation *c;
+ struct im_connection *ic;
+ struct groupchat *c;
GSList *l;
/* This finds the connection which has a conversation which belongs to this channel */
for( l = connections; l; l = l->next )
{
- gc = l->data;
- for( c = gc->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
+ ic = l->data;
+ for( c = ic->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
if( c )
return c;
}
@@ -898,7 +898,7 @@ char *set_eval_away_devoice( set_t *set, char *value )
while( u )
{
- if( u->gc && u->online && !u->away )
+ if( u->ic && u->online && !u->away )
{
if( ( strlen( list ) + strlen( u->nick ) ) >= 79 )
{
@@ -932,49 +932,49 @@ char *set_eval_away_devoice( set_t *set, char *value )
/* The plan is to not allow straight calls to prpl functions anymore, but do
them all from some wrappers. We'll start to define some down here: */
-int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags )
+int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags )
{
char *buf = NULL;
int st;
- if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+ if( ( ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
{
buf = escape_html( msg );
msg = buf;
}
- st = gc->acc->prpl->send_im( gc, handle, msg, strlen( msg ), flags );
+ st = ic->acc->prpl->send_im( ic, handle, msg, flags );
g_free( buf );
return st;
}
-int bim_chat_msg( struct conversation *c, char *msg )
+int bim_chat_msg( struct groupchat *c, char *msg, int flags )
{
char *buf = NULL;
int st;
- if( ( c->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+ if( ( c->ic->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
{
buf = escape_html( msg );
msg = buf;
}
- st = c->gc->acc->prpl->chat_send( c, msg );
+ c->ic->acc->prpl->chat_send( c, msg, flags );
g_free( buf );
- return st;
+ return 1;
}
static char *bim_away_alias_find( GList *gcm, char *away );
-int bim_set_away( struct gaim_connection *gc, char *away )
+int bim_set_away( struct im_connection *ic, char *away )
{
GList *m, *ms;
char *s;
if( !away ) away = "";
- ms = m = gc->acc->prpl->away_states( gc );
+ ms = m = ic->acc->prpl->away_states( ic );
while( m )
{
@@ -995,19 +995,19 @@ int bim_set_away( struct gaim_connection *gc, char *away )
if( m )
{
- gc->acc->prpl->set_away( gc, m->data, *away ? away : NULL );
+ ic->acc->prpl->set_away( ic, m->data, *away ? away : NULL );
}
else
{
s = bim_away_alias_find( ms, away );
if( s )
{
- gc->acc->prpl->set_away( gc, s, away );
- if( set_getbool( &gc->irc->set, "debug" ) )
- serv_got_crap( gc, "Setting away state to %s", s );
+ ic->acc->prpl->set_away( ic, s, away );
+ if( set_getbool( &ic->irc->set, "debug" ) )
+ serv_got_crap( ic, "Setting away state to %s", s );
}
else
- gc->acc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );
+ ic->acc->prpl->set_away( ic, GAIM_AWAY_CUSTOM, away );
}
return( 1 );
@@ -1055,48 +1055,48 @@ static char *bim_away_alias_find( GList *gcm, char *away )
return( NULL );
}
-void bim_add_allow( struct gaim_connection *gc, char *handle )
+void bim_add_allow( struct im_connection *ic, char *handle )
{
- if( g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL )
+ if( g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
{
- gc->permit = g_slist_prepend( gc->permit, g_strdup( handle ) );
+ ic->permit = g_slist_prepend( ic->permit, g_strdup( handle ) );
}
- gc->acc->prpl->add_permit( gc, handle );
+ ic->acc->prpl->add_permit( ic, handle );
}
-void bim_rem_allow( struct gaim_connection *gc, char *handle )
+void bim_rem_allow( struct im_connection *ic, char *handle )
{
GSList *l;
- if( ( l = g_slist_find_custom( gc->permit, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) )
+ if( ( l = g_slist_find_custom( ic->permit, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) ) )
{
g_free( l->data );
- gc->permit = g_slist_delete_link( gc->permit, l );
+ ic->permit = g_slist_delete_link( ic->permit, l );
}
- gc->acc->prpl->rem_permit( gc, handle );
+ ic->acc->prpl->rem_permit( ic, handle );
}
-void bim_add_block( struct gaim_connection *gc, char *handle )
+void bim_add_block( struct im_connection *ic, char *handle )
{
- if( g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) == NULL )
+ if( g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) == NULL )
{
- gc->deny = g_slist_prepend( gc->deny, g_strdup( handle ) );
+ ic->deny = g_slist_prepend( ic->deny, g_strdup( handle ) );
}
- gc->acc->prpl->add_deny( gc, handle );
+ ic->acc->prpl->add_deny( ic, handle );
}
-void bim_rem_block( struct gaim_connection *gc, char *handle )
+void bim_rem_block( struct im_connection *ic, char *handle )
{
GSList *l;
- if( ( l = g_slist_find_custom( gc->deny, handle, (GCompareFunc) gc->acc->prpl->handle_cmp ) ) )
+ if( ( l = g_slist_find_custom( ic->deny, handle, (GCompareFunc) ic->acc->prpl->handle_cmp ) ) )
{
g_free( l->data );
- gc->deny = g_slist_delete_link( gc->deny, l );
+ ic->deny = g_slist_delete_link( ic->deny, l );
}
- gc->acc->prpl->rem_deny( gc, handle );
+ ic->acc->prpl->rem_deny( ic, handle );
}
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 6afa1801..82472fd3 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -61,7 +61,7 @@
#define OPT_LOGGING_OUT 0x00020000
/* ok. now the fun begins. first we create a connection structure */
-struct gaim_connection
+struct im_connection
{
account_t *acc;
guint32 flags;
@@ -91,19 +91,19 @@ struct gaim_connection
/* BitlBee */
irc_t *irc;
- struct conversation *conversations;
+ struct groupchat *conversations;
};
/* struct buddy_chat went away and got merged with this. */
-struct conversation {
- struct gaim_connection *gc;
+struct groupchat {
+ struct im_connection *ic;
/* stuff used just for chat */
GList *in_room;
GList *ignored;
/* BitlBee */
- struct conversation *next;
+ struct groupchat *next;
char *channel;
char *title;
char joined;
@@ -120,49 +120,57 @@ struct buddy {
int uc;
guint caps; /* woohoo! */
void *proto_data; /* what a hack */
- struct gaim_connection *gc; /* the connection it belongs to */
+ struct im_connection *ic; /* the connection it belongs to */
};
struct prpl {
int options;
const char *name;
- void (* acc_init) (account_t *);
+ /* Added this one to be able to add per-account settings, don't think
+ it should be used for anything else. */
+ void (* init) (account_t *);
+ /* These should all be pretty obvious. */
void (* login) (account_t *);
- void (* keepalive) (struct gaim_connection *);
- void (* close) (struct gaim_connection *);
-
- int (* send_im) (struct gaim_connection *, char *who, char *message, int len, int away);
- void (* set_away) (struct gaim_connection *, char *state, char *message);
- void (* get_away) (struct gaim_connection *, char *who);
- int (* send_typing) (struct gaim_connection *, char *who, int typing);
-
- void (* add_buddy) (struct gaim_connection *, char *name);
- void (* group_buddy) (struct gaim_connection *, char *who, char *old_group, char *new_group);
- void (* remove_buddy) (struct gaim_connection *, char *name, char *group);
- void (* add_permit) (struct gaim_connection *, char *name);
- void (* add_deny) (struct gaim_connection *, char *name);
- void (* rem_permit) (struct gaim_connection *, char *name);
- void (* rem_deny) (struct gaim_connection *, char *name);
- void (* set_permit_deny)(struct gaim_connection *);
-
- void (* set_info) (struct gaim_connection *, char *info);
- void (* get_info) (struct gaim_connection *, char *who);
- void (* alias_buddy) (struct gaim_connection *, char *who); /* save/store buddy's alias on server list/roster */
+ void (* keepalive) (struct im_connection *);
+ void (* logout) (struct im_connection *);
+
+ int (* send_im) (struct im_connection *, char *to, char *message, int flags);
+ void (* set_away) (struct im_connection *, char *state, char *message);
+ void (* get_away) (struct im_connection *, char *who);
+ int (* send_typing) (struct im_connection *, char *who, int typing);
+
+ /* For now BitlBee doesn't really handle groups, just set it to NULL. */
+ void (* add_buddy) (struct im_connection *, char *name, char *group);
+ void (* remove_buddy) (struct im_connection *, char *name, char *group);
+
+ /* Block list stuff. */
+ void (* add_permit) (struct im_connection *, char *who);
+ void (* add_deny) (struct im_connection *, char *who);
+ void (* rem_permit) (struct im_connection *, char *who);
+ void (* rem_deny) (struct im_connection *, char *who);
+ /* Doesn't actually have UI hooks. */
+ void (* set_permit_deny)(struct im_connection *);
+
+ /* Request profile info. Free-formatted stuff, the IM module gives back
+ this info via imc_log(). */
+ void (* get_info) (struct im_connection *, char *who);
+ void (* set_my_name) (struct im_connection *, char *name);
+ void (* set_name) (struct im_connection *, char *who, char *name);
/* Group chat stuff. */
- void (* chat_invite) (struct conversation *, char *who, char *message);
- void (* chat_leave) (struct conversation *);
- int (* chat_send) (struct conversation *, char *message);
- struct conversation *
- (* chat_open) (struct gaim_connection *, char *who);
- struct conversation *
- (* chat_join) (struct gaim_connection *, char *chat, char *nick, char *password);
+ void (* chat_invite) (struct groupchat *, char *who, char *message);
+ void (* chat_leave) (struct groupchat *);
+ void (* chat_send) (struct groupchat *, char *message, int flags);
+ struct groupchat *
+ (* chat_with) (struct im_connection *, char *who);
+ struct groupchat *
+ (* chat_join) (struct im_connection *, char *chat, char *nick, char *password);
/* DIE! */
- char *(* get_status_string) (struct gaim_connection *gc, int stat);
+ char *(* get_status_string) (struct im_connection *ic, int stat);
- GList *(* away_states)(struct gaim_connection *gc);
+ GList *(* away_states)(struct im_connection *ic);
/* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */
int (* handle_cmp) (const char *who1, const char *who2);
@@ -181,14 +189,14 @@ G_MODULE_EXPORT struct prpl *find_protocol(const char *name);
G_MODULE_EXPORT void register_protocol(struct prpl *);
/* nogaim.c */
-int bim_set_away( struct gaim_connection *gc, char *away );
-int bim_buddy_msg( struct gaim_connection *gc, char *handle, char *msg, int flags );
-int bim_chat_msg( struct conversation *c, char *msg );
+int bim_set_away( struct im_connection *ic, char *away );
+int bim_buddy_msg( struct im_connection *ic, char *handle, char *msg, int flags );
+int bim_chat_msg( struct groupchat *c, char *msg, int flags );
-void bim_add_allow( struct gaim_connection *gc, char *handle );
-void bim_rem_allow( struct gaim_connection *gc, char *handle );
-void bim_add_block( struct gaim_connection *gc, char *handle );
-void bim_rem_block( struct gaim_connection *gc, char *handle );
+void bim_add_allow( struct im_connection *ic, char *handle );
+void bim_rem_allow( struct im_connection *ic, char *handle );
+void bim_add_block( struct im_connection *ic, char *handle );
+void bim_rem_block( struct im_connection *ic, char *handle );
void nogaim_init();
char *set_eval_away_devoice( set_t *set, char *value );
@@ -197,43 +205,43 @@ gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
void cancel_auto_reconnect( struct account *a );
/* multi.c */
-G_MODULE_EXPORT struct gaim_connection *new_gaim_conn( account_t *acc );
-G_MODULE_EXPORT void destroy_gaim_conn( struct gaim_connection *gc );
-G_MODULE_EXPORT void set_login_progress( struct gaim_connection *gc, int step, char *msg );
-G_MODULE_EXPORT void hide_login_progress( struct gaim_connection *gc, char *msg );
-G_MODULE_EXPORT void hide_login_progress_error( struct gaim_connection *gc, char *msg );
-G_MODULE_EXPORT void serv_got_crap( struct gaim_connection *gc, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
-G_MODULE_EXPORT void account_online( struct gaim_connection *gc );
-G_MODULE_EXPORT void signoff( struct gaim_connection *gc );
+G_MODULE_EXPORT struct im_connection *new_gaim_conn( account_t *acc );
+G_MODULE_EXPORT void destroy_gaim_conn( struct im_connection *ic );
+G_MODULE_EXPORT void set_login_progress( struct im_connection *ic, int step, char *msg );
+G_MODULE_EXPORT void hide_login_progress( struct im_connection *ic, char *msg );
+G_MODULE_EXPORT void hide_login_progress_error( struct im_connection *ic, char *msg );
+G_MODULE_EXPORT void serv_got_crap( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
+G_MODULE_EXPORT void account_online( struct im_connection *ic );
+G_MODULE_EXPORT void signoff( struct im_connection *ic );
/* dialogs.c */
-G_MODULE_EXPORT void do_error_dialog( struct gaim_connection *gc, char *msg, char *title );
-G_MODULE_EXPORT void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont );
+G_MODULE_EXPORT void do_error_dialog( struct im_connection *ic, char *msg, char *title );
+G_MODULE_EXPORT void do_ask_dialog( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );
/* list.c */
-G_MODULE_EXPORT void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *realname );
-G_MODULE_EXPORT struct buddy *find_buddy( struct gaim_connection *gc, char *handle );
-G_MODULE_EXPORT void signoff_blocked( struct gaim_connection *gc );
+G_MODULE_EXPORT void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname );
+G_MODULE_EXPORT struct buddy *find_buddy( struct im_connection *ic, char *handle );
+G_MODULE_EXPORT void signoff_blocked( struct im_connection *ic );
-G_MODULE_EXPORT void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname );
+G_MODULE_EXPORT void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname );
/* buddy_chat.c */
-G_MODULE_EXPORT void add_chat_buddy( struct conversation *b, char *handle );
-G_MODULE_EXPORT void remove_chat_buddy( struct conversation *b, char *handle, char *reason );
+G_MODULE_EXPORT void add_chat_buddy( struct groupchat *b, char *handle );
+G_MODULE_EXPORT void remove_chat_buddy( struct groupchat *b, char *handle, char *reason );
/* prpl.c */
-G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *handle, const char *realname );
+G_MODULE_EXPORT void show_got_added( struct im_connection *ic, char *handle, const char *realname );
/* server.c */
-G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
-G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
-G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
-G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
-G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, char *handle );
-G_MODULE_EXPORT void serv_got_chat_in( struct conversation *c, char *who, int whisper, char *msg, time_t mtime );
-G_MODULE_EXPORT void serv_got_chat_left( struct conversation *c );
-
-struct conversation *chat_by_channel( char *channel );
-struct conversation *chat_by_id( int id );
+G_MODULE_EXPORT void serv_got_update( struct im_connection *ic, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
+G_MODULE_EXPORT void serv_got_im( struct im_connection *ic, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
+G_MODULE_EXPORT void serv_got_typing( struct im_connection *ic, char *handle, int timeout, int type );
+G_MODULE_EXPORT void serv_got_chat_invite( struct im_connection *ic, char *handle, char *who, char *msg, GList *data );
+G_MODULE_EXPORT struct groupchat *serv_got_joined_chat( struct im_connection *ic, char *handle );
+G_MODULE_EXPORT void serv_got_chat_in( struct groupchat *c, char *who, int whisper, char *msg, time_t mtime );
+G_MODULE_EXPORT void serv_got_chat_left( struct groupchat *c );
+
+struct groupchat *chat_by_channel( char *channel );
+struct groupchat *chat_by_id( int id );
#endif
diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h
index 93887103..81ea5f9e 100644
--- a/protocols/oscar/aim.h
+++ b/protocols/oscar/aim.h
@@ -573,7 +573,7 @@ struct aim_chat_roominfo {
};
struct aim_chat_invitation {
- struct gaim_connection * gc;
+ struct im_connection * ic;
char * name;
guint8 exchange;
};
diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c
index 7cccabc7..bc2c2abe 100644
--- a/protocols/oscar/im.c
+++ b/protocols/oscar/im.c
@@ -1416,7 +1416,7 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod
guint8 msgtype, msgflags;
guint8 *plugin;
int i = 0, tmp = 0;
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
/* at the moment we just can deal with requests, not with cancel or accept */
if (args->status != 0) return;
@@ -1468,7 +1468,7 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod
case AIM_MTYPE_AUTOFFC:
case 0x9c: /* ICQ 5 seems to send this */
aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie,
- gc->away ? gc->away : "", sess->aim_icq_state, dc);
+ ic->away ? ic->away : "", sess->aim_icq_state, dc);
break;
}
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 05539442..d2c6af1e 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -115,21 +115,21 @@ struct chat_connection {
aim_conn_t *conn;
int inpa;
int id;
- struct gaim_connection *gc; /* i hate this. */
- struct conversation *cnv; /* bah. */
+ struct im_connection *ic; /* i hate this. */
+ struct groupchat *cnv; /* bah. */
int maxlen;
int maxvis;
};
struct ask_direct {
- struct gaim_connection *gc;
+ struct im_connection *ic;
char *sn;
char ip[64];
guint8 cookie[8];
};
struct icq_auth {
- struct gaim_connection *gc;
+ struct im_connection *ic;
guint32 uin;
};
@@ -157,9 +157,9 @@ static char *extract_name(const char *name) {
return tmp;
}
-static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc,
+static struct chat_connection *find_oscar_chat_by_conn(struct im_connection *ic,
aim_conn_t *conn) {
- GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
+ GSList *g = ((struct oscar_data *)ic->proto_data)->oscar_chats;
struct chat_connection *c = NULL;
while (g) {
@@ -242,34 +242,34 @@ static gboolean oscar_callback(gpointer data, gint source,
b_input_condition condition) {
aim_conn_t *conn = (aim_conn_t *)data;
aim_session_t *sess = aim_conn_getsess(conn);
- struct gaim_connection *gc = sess ? sess->aux_data : NULL;
+ struct im_connection *ic = sess ? sess->aux_data : NULL;
struct oscar_data *odata;
- if (!gc) {
- /* gc is null. we return, else we seg SIGSEG on next line. */
+ if (!ic) {
+ /* ic is null. we return, else we seg SIGSEG on next line. */
return FALSE;
}
- if (!g_slist_find(get_connections(), gc)) {
+ if (!g_slist_find(get_connections(), ic)) {
/* oh boy. this is probably bad. i guess the only thing we
* can really do is return? */
return FALSE;
}
- odata = (struct oscar_data *)gc->proto_data;
+ odata = (struct oscar_data *)ic->proto_data;
if (condition & GAIM_INPUT_READ) {
if (aim_get_command(odata->sess, conn) >= 0) {
aim_rxdispatch(odata->sess);
if (odata->killme)
- signoff(gc);
+ signoff(ic);
} else {
if ((conn->type == AIM_CONN_TYPE_BOS) ||
!(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
- hide_login_progress_error(gc, _("Disconnected."));
- signoff(gc);
+ hide_login_progress_error(ic, _("Disconnected."));
+ signoff(ic);
} else if (conn->type == AIM_CONN_TYPE_CHAT) {
- struct chat_connection *c = find_oscar_chat_by_conn(gc, conn);
+ struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
char buf[BUF_LONG];
c->conn = NULL;
if (c->inpa > 0)
@@ -312,34 +312,34 @@ static gboolean oscar_callback(gpointer data, gint source,
static gboolean oscar_login_connect(gpointer data, gint source, b_input_condition cond)
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
struct oscar_data *odata;
aim_session_t *sess;
aim_conn_t *conn;
- if (!g_slist_find(get_connections(), gc)) {
+ if (!g_slist_find(get_connections(), ic)) {
closesocket(source);
return FALSE;
}
- odata = gc->proto_data;
+ odata = ic->proto_data;
sess = odata->sess;
conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
if (source < 0) {
- hide_login_progress(gc, _("Couldn't connect to host"));
- signoff(gc);
+ hide_login_progress(ic, _("Couldn't connect to host"));
+ signoff(ic);
return FALSE;
}
aim_conn_completeconnect(sess, conn);
- gc->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
+ ic->inpa = b_input_add(conn->fd, GAIM_INPUT_READ,
oscar_callback, conn);
return FALSE;
}
-static void oscar_acc_init(account_t *acc)
+static void oscar_init(account_t *acc)
{
set_t *s;
@@ -356,17 +356,17 @@ static void oscar_login(account_t *acc) {
aim_session_t *sess;
aim_conn_t *conn;
char buf[256];
- struct gaim_connection *gc = new_gaim_conn(acc);
- struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
+ struct im_connection *ic = new_gaim_conn(acc);
+ struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
if (isdigit(acc->user[0])) {
odata->icq = TRUE;
/* This is odd but it's necessary for a proper do_import and do_export.
We don't do those anymore, but let's stick with it, just in case
it accidentally fixes something else too... </bitlbee> */
- gc->password[8] = 0;
+ ic->password[8] = 0;
} else {
- gc->flags |= OPT_CONN_HTML;
+ ic->flags |= OPT_CONN_HTML;
}
sess = g_new0(aim_session_t, 1);
@@ -377,44 +377,44 @@ static void oscar_login(account_t *acc) {
* see if things need to be sent. */
aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
odata->sess = sess;
- sess->aux_data = gc;
+ sess->aux_data = ic;
conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
if (conn == NULL) {
- hide_login_progress(gc, _("Unable to login to AIM"));
- signoff(gc);
+ hide_login_progress(ic, _("Unable to login to AIM"));
+ signoff(ic);
return;
}
if (acc->server == NULL) {
- hide_login_progress(gc, "No servername specified");
- signoff(gc);
+ hide_login_progress(ic, "No servername specified");
+ signoff(ic);
return;
}
if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
- serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
+ serv_got_crap(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
}
- g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
- set_login_progress(gc, 2, buf);
+ g_snprintf(buf, sizeof(buf), _("Signon: %s"), ic->username);
+ set_login_progress(ic, 2, buf);
aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
conn->status |= AIM_CONN_STATUS_INPROGRESS;
- conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, gc);
+ conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
if (conn->fd < 0) {
- hide_login_progress(gc, _("Couldn't connect to host"));
- signoff(gc);
+ hide_login_progress(ic, _("Couldn't connect to host"));
+ signoff(ic);
return;
}
- aim_request_login(sess, conn, gc->username);
+ aim_request_login(sess, conn, ic->username);
}
-static void oscar_close(struct gaim_connection *gc) {
- struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+static void oscar_logout(struct im_connection *ic) {
+ struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
while (odata->oscar_chats) {
struct chat_connection *n = odata->oscar_chats->data;
@@ -437,8 +437,8 @@ static void oscar_close(struct gaim_connection *gc) {
g_free(odata->newp);
if (odata->oldp)
g_free(odata->oldp);
- if (gc->inpa > 0)
- b_event_remove(gc->inpa);
+ if (ic->inpa > 0)
+ b_event_remove(ic->inpa);
if (odata->cnpa > 0)
b_event_remove(odata->cnpa);
if (odata->paspa > 0)
@@ -446,35 +446,35 @@ static void oscar_close(struct gaim_connection *gc) {
aim_session_kill(odata->sess);
g_free(odata->sess);
odata->sess = NULL;
- g_free(gc->proto_data);
- gc->proto_data = NULL;
+ g_free(ic->proto_data);
+ ic->proto_data = NULL;
}
static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
struct oscar_data *odata;
aim_session_t *sess;
aim_conn_t *bosconn;
- if (!g_slist_find(get_connections(), gc)) {
+ if (!g_slist_find(get_connections(), ic)) {
closesocket(source);
return FALSE;
}
- odata = gc->proto_data;
+ odata = ic->proto_data;
sess = odata->sess;
bosconn = odata->conn;
if (source < 0) {
- hide_login_progress(gc, _("Could Not Connect"));
- signoff(gc);
+ hide_login_progress(ic, _("Could Not Connect"));
+ signoff(ic);
return FALSE;
}
aim_conn_completeconnect(sess, bosconn);
- gc->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
+ ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
oscar_callback, bosconn);
- set_login_progress(gc, 4, _("Connection established, cookie sent"));
+ set_login_progress(ic, 4, _("Connection established, cookie sent"));
return FALSE;
}
@@ -485,8 +485,8 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
int i; char *host; int port;
aim_conn_t *bosconn;
- struct gaim_connection *gc = sess->aux_data;
- struct oscar_data *od = gc->proto_data;
+ struct im_connection *ic = sess->aux_data;
+ struct oscar_data *od = ic->proto_data;
port = AIM_LOGIN_PORT;
va_start(ap, fr);
@@ -497,23 +497,23 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
switch (info->errorcode) {
case 0x05:
/* Incorrect nick/password */
- hide_login_progress(gc, _("Incorrect nickname or password."));
+ hide_login_progress(ic, _("Incorrect nickname or password."));
// plugin_event(event_error, (void *)980, 0, 0, 0);
break;
case 0x11:
/* Suspended account */
- hide_login_progress(gc, _("Your account is currently suspended."));
+ hide_login_progress(ic, _("Your account is currently suspended."));
break;
case 0x18:
/* connecting too frequently */
- hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
+ hide_login_progress(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
break;
case 0x1c:
/* client too old */
- hide_login_progress(gc, _("The client version you are using is too old. Please upgrade at " WEBSITE));
+ hide_login_progress(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
break;
default:
- hide_login_progress(gc, _("Authentication Failed"));
+ hide_login_progress(ic, _("Authentication Failed"));
break;
}
od->killme = TRUE;
@@ -525,7 +525,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
if (bosconn == NULL) {
- hide_login_progress(gc, _("Internal Error"));
+ hide_login_progress(ic, _("Internal Error"));
od->killme = TRUE;
return 0;
}
@@ -559,7 +559,7 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parseaiminfo, 0);
aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parsemtn, 0);
- ((struct oscar_data *)gc->proto_data)->conn = bosconn;
+ ((struct oscar_data *)ic->proto_data)->conn = bosconn;
for (i = 0; i < (int)strlen(info->bosip); i++) {
if (info->bosip[i] == ':') {
port = atoi(&(info->bosip[i+1]));
@@ -568,21 +568,21 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
}
host = g_strndup(info->bosip, i);
bosconn->status |= AIM_CONN_STATUS_INPROGRESS;
- bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc);
+ bosconn->fd = proxy_connect(host, port, oscar_bos_connect, ic);
g_free(host);
if (bosconn->fd < 0) {
- hide_login_progress(gc, _("Could Not Connect"));
+ hide_login_progress(ic, _("Could Not Connect"));
od->killme = TRUE;
return 0;
}
aim_sendcookie(sess, bosconn, info->cookie);
- b_event_remove(gc->inpa);
+ b_event_remove(ic->inpa);
return 1;
}
struct pieceofcrap {
- struct gaim_connection *gc;
+ struct im_connection *ic;
unsigned long offset;
unsigned long len;
char *modname;
@@ -594,7 +594,7 @@ struct pieceofcrap {
static gboolean damn_you(gpointer data, gint source, b_input_condition c)
{
struct pieceofcrap *pos = data;
- struct oscar_data *od = pos->gc->proto_data;
+ struct oscar_data *od = pos->ic->proto_data;
char in = '\0';
int x = 0;
unsigned char m[17];
@@ -609,7 +609,7 @@ static gboolean damn_you(gpointer data, gint source, b_input_condition c)
in = '\0';
}
if (in != '\n') {
- do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
+ do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
" You may be disconnected shortly.", "Login Error");
b_event_remove(pos->inpa);
closesocket(pos->fd);
@@ -632,7 +632,7 @@ static gboolean straight_to_hell(gpointer data, gint source, b_input_condition c
char buf[BUF_LONG];
if (source < 0) {
- do_error_dialog(pos->gc, "Gaim was unable to get a valid hash for logging into AIM."
+ do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
" You may be disconnected shortly.", "Login Error");
if (pos->modname)
g_free(pos->modname);
@@ -698,7 +698,7 @@ int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
*/
pos = g_new0(struct pieceofcrap, 1);
- pos->gc = sess->aux_data;
+ pos->ic = sess->aux_data;
pos->conn = fr->conn;
pos->offset = offset;
@@ -726,19 +726,19 @@ static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
#endif
char *key;
va_list ap;
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
va_start(ap, fr);
key = va_arg(ap, char *);
va_end(ap);
- aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key);
+ aim_send_login(sess, fr->conn, ic->username, ic->password, &info, key);
return 1;
}
static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
struct chat_connection *chatcon;
static int id = 1;
@@ -750,9 +750,9 @@ static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
aim_clientready(sess, fr->conn);
- chatcon = find_oscar_chat_by_conn(gc, fr->conn);
+ chatcon = find_oscar_chat_by_conn(ic, fr->conn);
chatcon->id = id;
- chatcon->cnv = serv_got_joined_chat(gc, chatcon->show);
+ chatcon->cnv = serv_got_joined_chat(ic, chatcon->show);
chatcon->cnv->data = chatcon;
return 1;
@@ -771,17 +771,17 @@ static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) {
}
static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
struct oscar_data *odata;
aim_session_t *sess;
aim_conn_t *tstconn;
- if (!g_slist_find(get_connections(), gc)) {
+ if (!g_slist_find(get_connections(), ic)) {
closesocket(source);
return FALSE;
}
- odata = gc->proto_data;
+ odata = ic->proto_data;
sess = odata->sess;
tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV);
@@ -799,17 +799,17 @@ static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condit
static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition cond)
{
- struct gaim_connection *gc = data;
+ struct im_connection *ic = data;
struct oscar_data *odata;
aim_session_t *sess;
aim_conn_t *tstconn;
- if (!g_slist_find(get_connections(), gc)) {
+ if (!g_slist_find(get_connections(), ic)) {
closesocket(source);
return FALSE;
}
- odata = gc->proto_data;
+ odata = ic->proto_data;
sess = odata->sess;
tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH);
@@ -828,12 +828,12 @@ static gboolean oscar_auth_connect(gpointer data, gint source, b_input_condition
static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition cond)
{
struct chat_connection *ccon = data;
- struct gaim_connection *gc = ccon->gc;
+ struct im_connection *ic = ccon->ic;
struct oscar_data *odata;
aim_session_t *sess;
aim_conn_t *tstconn;
- if (!g_slist_find(get_connections(), gc)) {
+ if (!g_slist_find(get_connections(), ic)) {
closesocket(source);
g_free(ccon->show);
g_free(ccon->name);
@@ -841,7 +841,7 @@ static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition
return FALSE;
}
- odata = gc->proto_data;
+ odata = ic->proto_data;
sess = odata->sess;
tstconn = ccon->conn;
@@ -866,7 +866,7 @@ static gboolean oscar_chat_connect(gpointer data, gint source, b_input_condition
static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
struct aim_redirect_data *redir;
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
aim_conn_t *tstconn;
int i;
char *host;
@@ -898,7 +898,7 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
// aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0);
tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
- tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc);
+ tstconn->fd = proxy_connect(host, port, oscar_auth_connect, ic);
if (tstconn->fd < 0) {
aim_conn_kill(sess, &tstconn);
g_free(host);
@@ -915,7 +915,7 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0);
tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
- tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc);
+ tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, ic);
if (tstconn->fd < 0) {
aim_conn_kill(sess, &tstconn);
g_free(host);
@@ -937,7 +937,7 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
ccon = g_new0(struct chat_connection, 1);
ccon->conn = tstconn;
- ccon->gc = gc;
+ ccon->ic = ic;
ccon->fd = -1;
ccon->name = g_strdup(redir->chat.room);
ccon->exchange = redir->chat.exchange;
@@ -966,8 +966,8 @@ static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
}
static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
- struct gaim_connection *gc = sess->aux_data;
- struct oscar_data *od = gc->proto_data;
+ struct im_connection *ic = sess->aux_data;
+ struct oscar_data *od = ic->proto_data;
aim_userinfo_t *info;
time_t time_idle = 0, signon = 0;
int type = 0;
@@ -1017,12 +1017,12 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
signon = time(NULL) - info->sessionlen;
- tmp = g_strdup(normalize(gc->username));
+ tmp = g_strdup(normalize(ic->username));
if (!strcmp(tmp, normalize(info->sn)))
- g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
+ g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn);
g_free(tmp);
- serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon,
+ serv_got_update(ic, info->sn, 1, info->warnlevel/10, signon,
time_idle, type, caps);
return 1;
@@ -1031,20 +1031,20 @@ static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) {
aim_userinfo_t *info;
va_list ap;
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
va_start(ap, fr);
info = va_arg(ap, aim_userinfo_t *);
va_end(ap);
- serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0);
+ serv_got_update(ic, info->sn, 0, 0, 0, 0, 0, 0);
return 1;
}
static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
char *tmp = g_malloc(BUF_LONG + 1);
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
int flags = 0;
if (args->icbmflags & AIM_IMFLAGS_AWAY)
@@ -1082,7 +1082,7 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
g_snprintf(tmp, BUF_LONG, "%s", args->msg);
strip_linefeed(tmp);
- serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1);
+ serv_got_im(ic, userinfo->sn, tmp, flags, time(NULL), -1);
g_free(tmp);
return 1;
@@ -1092,7 +1092,7 @@ void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv);
void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv);
static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
if (args->status != AIM_RENDEZVOUS_PROPOSE)
return 1;
@@ -1110,11 +1110,11 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", name, userinfo->sn, args->msg );
- inv->gc = gc;
+ inv->ic = ic;
inv->exchange = *exch;
inv->name = g_strdup(name);
- do_ask_dialog( gc, txt, inv, oscar_accept_chat, oscar_reject_chat);
+ do_ask_dialog( ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
if (name)
g_free(name);
@@ -1125,14 +1125,14 @@ static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
char *uin, message;
- struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
+ struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
uin = g_strdup_printf("%u", data->uin);
message = 0;
aim_ssi_auth_reply(od->sess, od->conn, uin, 1, "");
// aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
- if(find_buddy(data->gc, uin) == NULL)
- show_got_added(data->gc, uin, NULL);
+ if(find_buddy(data->ic, uin) == NULL)
+ show_got_added(data->ic, uin, NULL);
g_free(uin);
g_free(data);
@@ -1140,7 +1140,7 @@ static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) {
static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) {
char *uin, *message;
- struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
+ struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
uin = g_strdup_printf("%u", data->uin);
message = g_strdup_printf("No reason given.");
@@ -1155,7 +1155,7 @@ static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) {
/*
* For when other people ask you for authorization
*/
-static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg) {
+static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) {
struct icq_auth *data = g_new(struct icq_auth, 1);
char *reason = NULL;
char *dialog_msg;
@@ -1164,14 +1164,14 @@ static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg)
reason = msg + 6;
dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");
- data->gc = gc;
+ data->ic = ic;
data->uin = uin;
- do_ask_dialog(gc, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
+ do_ask_dialog(ic, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
g_free(dialog_msg);
}
static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) {
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
switch (args->type) {
case 0x0001: { /* An almost-normal instant message. Mac ICQ sends this. It's peculiar. */
@@ -1179,7 +1179,7 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
uin = g_strdup_printf("%u", args->uin);
message = g_strdup(args->msg);
strip_linefeed(message);
- serv_got_im(gc, uin, message, 0, time(NULL), -1);
+ serv_got_im(ic, uin, message, 0, time(NULL), -1);
g_free(uin);
g_free(message);
} break;
@@ -1198,14 +1198,14 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
}
strip_linefeed(message);
- serv_got_im(gc, uin, message, 0, time(NULL), -1);
+ serv_got_im(ic, uin, message, 0, time(NULL), -1);
g_free(uin);
g_free(m);
g_free(message);
} break;
case 0x0006: { /* Someone requested authorization */
- gaim_icq_authask(gc, args->uin, args->msg);
+ gaim_icq_authask(ic, args->uin, args->msg);
} break;
case 0x0007: { /* Someone has denied you authorization */
@@ -1417,8 +1417,8 @@ static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) {
static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
guint16 type;
- struct gaim_connection *gc = sess->aux_data;
- struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+ struct im_connection *ic = sess->aux_data;
+ struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
va_start(ap, fr);
type = (guint16)va_arg(ap, unsigned int);
@@ -1476,7 +1476,7 @@ static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
int count, i;
aim_userinfo_t *info;
- struct gaim_connection *g = sess->aux_data;
+ struct im_connection *g = sess->aux_data;
struct chat_connection *c = NULL;
@@ -1499,7 +1499,7 @@ static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
int count, i;
aim_userinfo_t *info;
- struct gaim_connection *g = sess->aux_data;
+ struct im_connection *g = sess->aux_data;
struct chat_connection *c = NULL;
@@ -1527,8 +1527,8 @@ static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) {
char *roomdesc;
guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
guint32 creationtime;
- struct gaim_connection *gc = sess->aux_data;
- struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
+ struct im_connection *ic = sess->aux_data;
+ struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
va_start(ap, fr);
roominfo = va_arg(ap, struct aim_chat_roominfo *);
@@ -1554,8 +1554,8 @@ static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
aim_userinfo_t *info;
char *msg;
- struct gaim_connection *gc = sess->aux_data;
- struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn);
+ struct im_connection *ic = sess->aux_data;
+ struct chat_connection *ccon = find_oscar_chat_by_conn(ic, fr->conn);
char *tmp;
va_start(ap, fr);
@@ -1616,14 +1616,14 @@ static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) {
static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
aim_userinfo_t *info;
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
va_start(ap, fr);
info = va_arg(ap, aim_userinfo_t *);
va_end(ap);
- gc->evil = info->warnlevel/10;
- /* gc->correction_time = (info->onlinesince - gc->login_time); */
+ ic->evil = info->warnlevel/10;
+ /* ic->correction_time = (info->onlinesince - ic->login_time); */
return 1;
}
@@ -1645,8 +1645,8 @@ static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) {
}
static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) {
- struct gaim_connection *gc = sess->aux_data;
- struct oscar_data *od = gc->proto_data;
+ struct im_connection *ic = sess->aux_data;
+ struct oscar_data *od = ic->proto_data;
aim_clientready(sess, fr->conn);
@@ -1703,8 +1703,8 @@ static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...)
{
va_list ap;
guint16 maxsiglen;
- struct gaim_connection *gc = sess->aux_data;
- struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+ struct im_connection *ic = sess->aux_data;
+ struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
va_start(ap, fr);
maxsiglen = va_arg(ap, int);
@@ -1714,7 +1714,7 @@ static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...)
/* FIXME: It seems we're not really using this, and it broke now that
struct aim_user is dead.
- aim_bos_setprofile(sess, fr->conn, gc->user->user_info, NULL, gaim_caps);
+ aim_bos_setprofile(sess, fr->conn, ic->user->user_info, NULL, gaim_caps);
*/
return 1;
@@ -1723,8 +1723,8 @@ static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...)
static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
guint16 maxbuddies, maxwatchers;
- struct gaim_connection *gc = sess->aux_data;
- struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+ struct im_connection *ic = sess->aux_data;
+ struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
va_start(ap, fr);
maxbuddies = (guint16)va_arg(ap, unsigned int);
@@ -1740,8 +1740,8 @@ static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) {
static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) {
guint16 maxpermits, maxdenies;
va_list ap;
- struct gaim_connection *gc = sess->aux_data;
- struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+ struct im_connection *ic = sess->aux_data;
+ struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
va_start(ap, fr);
maxpermits = (guint16)va_arg(ap, unsigned int);
@@ -1764,7 +1764,7 @@ static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) {
static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) {
va_list ap;
struct aim_icq_offlinemsg *msg;
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
va_start(ap, fr);
msg = va_arg(ap, struct aim_icq_offlinemsg *);
@@ -1777,7 +1777,7 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) {
time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
g_snprintf(sender, sizeof(sender), "%u", msg->sender);
strip_linefeed(dialog_msg);
- serv_got_im(gc, sender, dialog_msg, 0, t, -1);
+ serv_got_im(ic, sender, dialog_msg, 0, t, -1);
g_free(dialog_msg);
} break;
@@ -1798,13 +1798,13 @@ static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) {
}
strip_linefeed(dialog_msg);
- serv_got_im(gc, sender, dialog_msg, 0, t, -1);
+ serv_got_im(ic, sender, dialog_msg, 0, t, -1);
g_free(dialog_msg);
g_free(m);
} break;
case 0x0006: { /* Authorization request */
- gaim_icq_authask(gc, msg->sender, msg->msg);
+ gaim_icq_authask(ic, msg->sender, msg->msg);
} break;
case 0x0007: { /* Someone has denied you authorization */
@@ -1832,14 +1832,14 @@ static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...)
return 1;
}
-static void oscar_keepalive(struct gaim_connection *gc) {
- struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
+static void oscar_keepalive(struct im_connection *ic) {
+ struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
aim_flap_nop(odata->sess, odata->conn);
}
-static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) {
- struct oscar_data *odata = (struct oscar_data *)gc->proto_data;
- int ret = 0;
+static int oscar_send_im(struct im_connection *ic, char *name, char *message, int imflags) {
+ struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+ int ret = 0, len = strlen(message);
if (imflags & IM_FLAG_AWAY) {
ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
} else {
@@ -1891,7 +1891,7 @@ static int oscar_send_im(struct gaim_connection *gc, char *name, char *message,
return ret;
}
-static void oscar_get_info(struct gaim_connection *g, char *name) {
+static void oscar_get_info(struct im_connection *g, char *name) {
struct oscar_data *odata = (struct oscar_data *)g->proto_data;
if (odata->icq)
aim_icq_getallinfo(odata->sess, name);
@@ -1901,7 +1901,7 @@ static void oscar_get_info(struct gaim_connection *g, char *name) {
}
}
-static void oscar_get_away(struct gaim_connection *g, char *who) {
+static void oscar_get_away(struct im_connection *g, char *who) {
struct oscar_data *odata = (struct oscar_data *)g->proto_data;
if (odata->icq) {
struct buddy *budlight = find_buddy(g, who);
@@ -1913,7 +1913,7 @@ static void oscar_get_away(struct gaim_connection *g, char *who) {
aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_AWAYMESSAGE);
}
-static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
+static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
{
if (!g_strcasecmp(state, _("Visible"))) {
@@ -1925,13 +1925,13 @@ static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od
} /* else... */
if (od->rights.maxawaymsglen == 0)
- do_error_dialog(gc, "oscar_set_away_aim called before locate rights received", "Protocol Error");
+ do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error");
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
- if (gc->away)
- g_free(gc->away);
- gc->away = NULL;
+ if (ic->away)
+ g_free(ic->away);
+ ic->away = NULL;
if (!message) {
aim_bos_setprofile(od->sess, od->conn, NULL, "", gaim_caps);
@@ -1943,26 +1943,26 @@ static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od
errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
- do_error_dialog(gc, errstr, "Away Message Too Long");
+ do_error_dialog(ic, errstr, "Away Message Too Long");
g_free(errstr);
}
- gc->away = g_strndup(message, od->rights.maxawaymsglen);
- aim_bos_setprofile(od->sess, od->conn, NULL, gc->away, gaim_caps);
+ ic->away = g_strndup(message, od->rights.maxawaymsglen);
+ aim_bos_setprofile(od->sess, od->conn, NULL, ic->away, gaim_caps);
return;
}
-static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message)
+static void oscar_set_away_icq(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
{
const char *msg = NULL;
gboolean no_message = FALSE;
/* clean old states */
- if (gc->away) {
- g_free(gc->away);
- gc->away = NULL;
+ if (ic->away) {
+ g_free(ic->away);
+ ic->away = NULL;
}
od->sess->aim_icq_state = 0;
@@ -1978,33 +1978,33 @@ static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
} else if (!g_strcasecmp(state, "Away")) {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
- gc->away = g_strdup(msg);
+ ic->away = g_strdup(msg);
od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
} else if (!g_strcasecmp(state, "Do Not Disturb")) {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY);
- gc->away = g_strdup(msg);
+ ic->away = g_strdup(msg);
od->sess->aim_icq_state = AIM_MTYPE_AUTODND;
} else if (!g_strcasecmp(state, "Not Available")) {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY);
- gc->away = g_strdup(msg);
+ ic->away = g_strdup(msg);
od->sess->aim_icq_state = AIM_MTYPE_AUTONA;
} else if (!g_strcasecmp(state, "Occupied")) {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY);
- gc->away = g_strdup(msg);
+ ic->away = g_strdup(msg);
od->sess->aim_icq_state = AIM_MTYPE_AUTOBUSY;
} else if (!g_strcasecmp(state, "Free For Chat")) {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT);
- gc->away = g_strdup(msg);
+ ic->away = g_strdup(msg);
od->sess->aim_icq_state = AIM_MTYPE_AUTOFFC;
} else if (!g_strcasecmp(state, "Invisible")) {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE);
- gc->away = g_strdup(msg);
+ ic->away = g_strdup(msg);
} else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) {
if (no_message) {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
} else {
aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY);
- gc->away = g_strdup(msg);
+ ic->away = g_strdup(msg);
od->sess->aim_icq_state = AIM_MTYPE_AUTOAWAY;
}
}
@@ -2012,23 +2012,23 @@ static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od
return;
}
-static void oscar_set_away(struct gaim_connection *gc, char *state, char *message)
+static void oscar_set_away(struct im_connection *ic, char *state, char *message)
{
- struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+ struct oscar_data *od = (struct oscar_data *)ic->proto_data;
- oscar_set_away_aim(gc, od, state, message);
+ oscar_set_away_aim(ic, od, state, message);
if (od->icq)
- oscar_set_away_icq(gc, od, state, message);
+ oscar_set_away_icq(ic, od, state, message);
return;
}
-static void oscar_add_buddy(struct gaim_connection *g, char *name) {
+static void oscar_add_buddy(struct im_connection *g, char *name, char *group) {
struct oscar_data *odata = (struct oscar_data *)g->proto_data;
aim_ssi_addbuddies(odata->sess, odata->conn, OSCAR_GROUP, &name, 1, 0);
}
-static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) {
+static void oscar_remove_buddy(struct im_connection *g, char *name, char *group) {
struct oscar_data *odata = (struct oscar_data *)g->proto_data;
struct aim_ssi_item *ssigroup;
while ((ssigroup = aim_ssi_itemlist_findparent(odata->sess->ssi.items, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1));
@@ -2039,7 +2039,7 @@ static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) {
}
static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
struct aim_ssi_item *curitem;
int tmp;
@@ -2048,13 +2048,13 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
for (curitem=sess->ssi.items; curitem; curitem=curitem->next) {
switch (curitem->type) {
case 0x0000: /* Buddy */
- if ((curitem->name) && (!find_buddy(gc, curitem->name))) {
+ if ((curitem->name) && (!find_buddy(ic, curitem->name))) {
char *realname = NULL;
if (curitem->data && aim_gettlv(curitem->data, 0x0131, 1))
realname = aim_gettlv_str(curitem->data, 0x0131, 1);
- add_buddy(gc, NULL, curitem->name, realname);
+ add_buddy(ic, NULL, curitem->name, realname);
if (realname)
g_free(realname);
@@ -2064,11 +2064,11 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
case 0x0002: /* Permit buddy */
if (curitem->name) {
GSList *list;
- for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
+ for (list=ic->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
if (!list) {
char *name;
name = g_strdup(normalize(curitem->name));
- gc->permit = g_slist_append(gc->permit, name);
+ ic->permit = g_slist_append(ic->permit, name);
tmp++;
}
}
@@ -2077,11 +2077,11 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
case 0x0003: /* Deny buddy */
if (curitem->name) {
GSList *list;
- for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
+ for (list=ic->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
if (!list) {
char *name;
name = g_strdup(normalize(curitem->name));
- gc->deny = g_slist_append(gc->deny, name);
+ ic->deny = g_slist_append(ic->deny, name);
tmp++;
}
}
@@ -2090,8 +2090,8 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
case 0x0004: /* Permit/deny setting */
if (curitem->data) {
guint8 permdeny;
- if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) {
- gc->permdeny = permdeny;
+ if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != ic->permdeny)) {
+ ic->permdeny = permdeny;
tmp++;
}
}
@@ -2109,7 +2109,7 @@ static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
aim_icq_reqofflinemsgs(sess);
/* Now that we have a buddy list, we can tell BitlBee that we're online. */
- account_online(gc);
+ account_online(ic);
return 1;
}
@@ -2154,22 +2154,22 @@ static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... )
return( 1 );
}
-static void oscar_set_permit_deny(struct gaim_connection *gc) {
- struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_set_permit_deny(struct im_connection *ic) {
+ struct oscar_data *od = (struct oscar_data *)ic->proto_data;
if (od->icq) {
GSList *list;
char buf[MAXMSGLEN];
int at;
- switch(gc->permdeny) {
+ switch(ic->permdeny) {
case 1:
- aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username);
+ aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->username);
break;
case 2:
- aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username);
+ aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->username);
break;
case 3:
- list = gc->permit;
+ list = ic->permit;
at = 0;
while (list) {
at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
@@ -2178,7 +2178,7 @@ static void oscar_set_permit_deny(struct gaim_connection *gc) {
aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
break;
case 4:
- list = gc->deny;
+ list = ic->deny;
at = 0;
while (list) {
at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);
@@ -2189,15 +2189,15 @@ static void oscar_set_permit_deny(struct gaim_connection *gc) {
default:
break;
}
- signoff_blocked(gc);
+ signoff_blocked(ic);
} else {
if (od->sess->ssi.received_data)
- aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff);
+ aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff);
}
}
-static void oscar_add_permit(struct gaim_connection *gc, char *who) {
- struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_add_permit(struct im_connection *ic, char *who) {
+ struct oscar_data *od = (struct oscar_data *)ic->proto_data;
if (od->icq) {
aim_ssi_auth_reply(od->sess, od->conn, who, 1, "");
} else {
@@ -2206,8 +2206,8 @@ static void oscar_add_permit(struct gaim_connection *gc, char *who) {
}
}
-static void oscar_add_deny(struct gaim_connection *gc, char *who) {
- struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_add_deny(struct im_connection *ic, char *who) {
+ struct oscar_data *od = (struct oscar_data *)ic->proto_data;
if (od->icq) {
aim_ssi_auth_reply(od->sess, od->conn, who, 0, "");
} else {
@@ -2216,25 +2216,25 @@ static void oscar_add_deny(struct gaim_connection *gc, char *who) {
}
}
-static void oscar_rem_permit(struct gaim_connection *gc, char *who) {
- struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_rem_permit(struct im_connection *ic, char *who) {
+ struct oscar_data *od = (struct oscar_data *)ic->proto_data;
if (!od->icq) {
if (od->sess->ssi.received_data)
aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT);
}
}
-static void oscar_rem_deny(struct gaim_connection *gc, char *who) {
- struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+static void oscar_rem_deny(struct im_connection *ic, char *who) {
+ struct oscar_data *od = (struct oscar_data *)ic->proto_data;
if (!od->icq) {
if (od->sess->ssi.received_data)
aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY);
}
}
-static GList *oscar_away_states(struct gaim_connection *gc)
+static GList *oscar_away_states(struct im_connection *ic)
{
- struct oscar_data *od = gc->proto_data;
+ struct oscar_data *od = ic->proto_data;
GList *m = NULL;
if (!od->icq)
@@ -2253,7 +2253,7 @@ static GList *oscar_away_states(struct gaim_connection *gc)
static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)
{
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
gchar who[16];
GString *str;
va_list ap;
@@ -2329,7 +2329,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)
g_string_sprintfa(str, "\n");
}
- serv_got_crap(gc, "%s\n%s", _("User Info"), str->str);
+ serv_got_crap(ic, "%s\n%s", _("User Info"), str->str);
g_string_free(str, TRUE);
return 1;
@@ -2394,7 +2394,7 @@ static char *oscar_encoding_to_utf8(char *encoding, char *text, int textlen)
static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...)
{
- struct gaim_connection *gc = sess->aux_data;
+ struct im_connection *ic = sess->aux_data;
va_list ap;
aim_userinfo_t *userinfo;
guint16 infotype;
@@ -2423,18 +2423,18 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...)
idletime.tm_min = userinfo->idletime % 60;
idletime.tm_sec = 0;
strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime);
- serv_got_crap(gc, "%s: %s", _("Idle Time"), buff);
+ serv_got_crap(ic, "%s: %s", _("Idle Time"), buff);
}
if(text) {
utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
- serv_got_crap(gc, "%s\n%s", _("User Info"), utf8);
+ serv_got_crap(ic, "%s\n%s", _("User Info"), utf8);
} else {
- serv_got_crap(gc, _("No user info available."));
+ serv_got_crap(ic, _("No user info available."));
}
} else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
- serv_got_crap(gc, "%s\n%s", _("Away Message"), utf8);
+ serv_got_crap(ic, "%s\n%s", _("Away Message"), utf8);
}
g_free(utf8);
@@ -2444,7 +2444,7 @@ static int gaim_parseaiminfo(aim_session_t *sess, aim_frame_t *fr, ...)
int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
{
- struct gaim_connection * gc = sess->aux_data;
+ struct im_connection * ic = sess->aux_data;
va_list ap;
guint16 type1, type2;
char * sn;
@@ -2457,23 +2457,23 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
if(type2 == 0x0002) {
/* User is typing */
- serv_got_typing(gc, sn, 0, 1);
+ serv_got_typing(ic, sn, 0, 1);
}
else if (type2 == 0x0001) {
/* User has typed something, but is not actively typing (stale) */
- serv_got_typing(gc, sn, 0, 2);
+ serv_got_typing(ic, sn, 0, 2);
}
else {
/* User has stopped typing */
- serv_got_typing(gc, sn, 0, 0);
+ serv_got_typing(ic, sn, 0, 0);
}
return 1;
}
-static char *oscar_get_status_string( struct gaim_connection *gc, int number )
+static char *oscar_get_status_string( struct im_connection *ic, int number )
{
- struct oscar_data *od = gc->proto_data;
+ struct oscar_data *od = ic->proto_data;
if( ! number & UC_UNAVAILABLE )
{
@@ -2499,16 +2499,16 @@ static char *oscar_get_status_string( struct gaim_connection *gc, int number )
}
}
-int oscar_send_typing(struct gaim_connection *gc, char * who, int typing)
+int oscar_send_typing(struct im_connection *ic, char * who, int typing)
{
- struct oscar_data *od = gc->proto_data;
+ struct oscar_data *od = ic->proto_data;
return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) );
}
-int oscar_chat_send(struct conversation *c, char *message)
+void oscar_chat_send(struct groupchat *c, char *message, int msgflags)
{
- struct gaim_connection *gc = c->gc;
- struct oscar_data * od = (struct oscar_data*)gc->proto_data;
+ struct im_connection *ic = c->ic;
+ struct oscar_data * od = (struct oscar_data*)ic->proto_data;
struct chat_connection * ccon;
int ret;
guint8 len = strlen(message);
@@ -2549,22 +2549,22 @@ int oscar_chat_send(struct conversation *c, char *message)
g_free(s);
}
- return (ret >= 0);
+/* return (ret >= 0); */
}
-void oscar_chat_invite(struct conversation *c, char *message, char *who)
+void oscar_chat_invite(struct groupchat *c, char *message, char *who)
{
- struct gaim_connection *gc = c->gc;
- struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+ struct im_connection *ic = c->ic;
+ struct oscar_data * od = (struct oscar_data *)ic->proto_data;
struct chat_connection *ccon = c->data;
aim_chat_invite(od->sess, od->conn, who, message ? message : "",
ccon->exchange, ccon->name, 0x0);
}
-void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc)
+void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc)
{
- struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+ struct oscar_data *od = (struct oscar_data *)ic->proto_data;
/* Notify the conversation window that we've left the chat */
serv_got_chat_left(cc->cnv);
@@ -2579,14 +2579,14 @@ void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc)
g_free(cc);
}
-void oscar_chat_leave(struct conversation *c)
+void oscar_chat_leave(struct groupchat *c)
{
- oscar_chat_kill(c->gc, c->data);
+ oscar_chat_kill(c->ic, c->data);
}
-int oscar_chat_join(struct gaim_connection * gc, char * name)
+int oscar_chat_join(struct im_connection * ic, char * name)
{
- struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+ struct oscar_data * od = (struct oscar_data *)ic->proto_data;
aim_conn_t * cur;
@@ -2604,16 +2604,16 @@ int oscar_chat_join(struct gaim_connection * gc, char * name)
}
}
-struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who)
+struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
{
- struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+ struct oscar_data * od = (struct oscar_data *)ic->proto_data;
int ret;
static int chat_id = 0;
char * chatname;
- chatname = g_strdup_printf("%s%d", gc->username, chat_id++);
+ chatname = g_strdup_printf("%s%d", ic->username, chat_id++);
- ret = oscar_chat_join(gc, chatname);
+ ret = oscar_chat_join(ic, chatname);
aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
@@ -2624,7 +2624,7 @@ struct conversation *oscar_chat_open(struct gaim_connection * gc, char *who)
void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv)
{
- oscar_chat_join(inv->gc, inv->name);
+ oscar_chat_join(inv->ic, inv->name);
g_free(inv->name);
g_free(inv);
}
@@ -2635,14 +2635,15 @@ void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv)
g_free(inv);
}
-void oscar_init()
+void oscar_initmodule()
{
struct prpl *ret = g_new0(struct prpl, 1);
ret->name = "oscar";
ret->away_states = oscar_away_states;
+ ret->init = oscar_init;
ret->login = oscar_login;
- ret->acc_init = oscar_acc_init;
- ret->close = oscar_close;
+ ret->keepalive = oscar_keepalive;
+ ret->logout = oscar_logout;
ret->send_im = oscar_send_im;
ret->get_info = oscar_get_info;
ret->set_away = oscar_set_away;
@@ -2652,13 +2653,12 @@ void oscar_init()
ret->chat_send = oscar_chat_send;
ret->chat_invite = oscar_chat_invite;
ret->chat_leave = oscar_chat_leave;
- ret->chat_open = oscar_chat_open;
+ ret->chat_with = oscar_chat_with;
ret->add_permit = oscar_add_permit;
ret->add_deny = oscar_add_deny;
ret->rem_permit = oscar_rem_permit;
ret->rem_deny = oscar_rem_deny;
ret->set_permit_deny = oscar_set_permit_deny;
- ret->keepalive = oscar_keepalive;
ret->get_status_string = oscar_get_status_string;
ret->send_typing = oscar_send_typing;
diff --git a/protocols/oscar/service.c b/protocols/oscar/service.c
index d55e0987..2a3dd1fb 100644
--- a/protocols/oscar/service.c
+++ b/protocols/oscar/service.c
@@ -731,11 +731,11 @@ int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, guint32 status)
aim_tlvlist_t *tl = NULL;
guint32 data;
int tlvlen;
- struct gaim_connection *gc = sess ? sess->aux_data : NULL;
+ struct im_connection *ic = sess ? sess->aux_data : NULL;
data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */
- if (gc && set_getbool(&gc->acc->set, "web_aware"))
+ if (ic && set_getbool(&ic->acc->set, "web_aware"))
data |= AIM_ICQ_STATE_WEBAWARE;
tlvlen = aim_addtlvtochain32(&tl, 0x0006, data);
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index e0dcabff..52db9007 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -57,10 +57,10 @@ struct byahoo_input_data
struct byahoo_conf_invitation
{
char *name;
- struct conversation *c;
+ struct groupchat *c;
int yid;
YList *members;
- struct gaim_connection *gc;
+ struct im_connection *ic;
};
static GSList *byahoo_inputs = NULL;
@@ -122,24 +122,24 @@ static char *byahoo_strip( char *in )
static void byahoo_login( account_t *acc )
{
- struct gaim_connection *gc = new_gaim_conn( acc );
- struct byahoo_data *yd = gc->proto_data = g_new0( struct byahoo_data, 1 );
+ struct im_connection *ic = new_gaim_conn( acc );
+ struct byahoo_data *yd = ic->proto_data = g_new0( struct byahoo_data, 1 );
yd->logged_in = FALSE;
yd->current_status = YAHOO_STATUS_AVAILABLE;
- set_login_progress( gc, 1, "Connecting" );
+ set_login_progress( ic, 1, "Connecting" );
yd->y2_id = yahoo_init( acc->user, acc->pass );
yahoo_login( yd->y2_id, yd->current_status );
}
-static void byahoo_close( struct gaim_connection *gc )
+static void byahoo_logout( struct im_connection *ic )
{
- struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
+ struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
GSList *l;
- while( gc->conversations )
- serv_got_chat_left( gc->conversations );
+ while( ic->conversations )
+ serv_got_chat_left( ic->conversations );
for( l = yd->buddygroups; l; l = l->next )
{
@@ -159,42 +159,42 @@ static void byahoo_close( struct gaim_connection *gc )
g_free( yd );
}
-static void byahoo_get_info(struct gaim_connection *gc, char *who)
+static void byahoo_get_info(struct im_connection *ic, char *who)
{
/* Just make an URL and let the user fetch the info */
- serv_got_crap(gc, "%s\n%s: %s%s", _("User Info"),
+ serv_got_crap(ic, "%s\n%s: %s%s", _("User Info"),
_("For now, fetch yourself"), yahoo_get_profile_url(),
who);
}
-static int byahoo_send_im( struct gaim_connection *gc, char *who, char *what, int len, int flags )
+static int byahoo_send_im( struct im_connection *ic, char *who, char *what, int flags )
{
- struct byahoo_data *yd = gc->proto_data;
+ struct byahoo_data *yd = ic->proto_data;
yahoo_send_im( yd->y2_id, NULL, who, what, 1 );
return 1;
}
-static int byahoo_send_typing( struct gaim_connection *gc, char *who, int typing )
+static int byahoo_send_typing( struct im_connection *ic, char *who, int typing )
{
- struct byahoo_data *yd = gc->proto_data;
+ struct byahoo_data *yd = ic->proto_data;
yahoo_send_typing( yd->y2_id, NULL, who, typing );
return 1;
}
-static void byahoo_set_away( struct gaim_connection *gc, char *state, char *msg )
+static void byahoo_set_away( struct im_connection *ic, char *state, char *msg )
{
- struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
+ struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
- gc->away = NULL;
+ ic->away = NULL;
if( state && msg && g_strcasecmp( state, msg ) != 0 )
{
yd->current_status = YAHOO_STATUS_CUSTOM;
- gc->away = "";
+ ic->away = "";
}
else if( state )
{
@@ -203,11 +203,11 @@ static void byahoo_set_away( struct gaim_connection *gc, char *state, char *msg
away state. */
msg = NULL;
- gc->away = "";
+ ic->away = "";
if( g_strcasecmp( state, "Available" ) == 0 )
{
yd->current_status = YAHOO_STATUS_AVAILABLE;
- gc->away = NULL;
+ ic->away = NULL;
}
else if( g_strcasecmp( state, "Be Right Back" ) == 0 )
yd->current_status = YAHOO_STATUS_BRB;
@@ -233,16 +233,16 @@ static void byahoo_set_away( struct gaim_connection *gc, char *state, char *msg
{
yd->current_status = YAHOO_STATUS_AVAILABLE;
- gc->away = NULL;
+ ic->away = NULL;
}
}
else
yd->current_status = YAHOO_STATUS_AVAILABLE;
- yahoo_set_away( yd->y2_id, yd->current_status, msg, gc->away != NULL );
+ yahoo_set_away( yd->y2_id, yd->current_status, msg, ic->away != NULL );
}
-static GList *byahoo_away_states( struct gaim_connection *gc )
+static GList *byahoo_away_states( struct im_connection *ic )
{
GList *m = NULL;
@@ -262,23 +262,23 @@ static GList *byahoo_away_states( struct gaim_connection *gc )
return m;
}
-static void byahoo_keepalive( struct gaim_connection *gc )
+static void byahoo_keepalive( struct im_connection *ic )
{
- struct byahoo_data *yd = gc->proto_data;
+ struct byahoo_data *yd = ic->proto_data;
yahoo_keepalive( yd->y2_id );
}
-static void byahoo_add_buddy( struct gaim_connection *gc, char *who )
+static void byahoo_add_buddy( struct im_connection *ic, char *who, char *group )
{
- struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
+ struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
- yahoo_add_buddy( yd->y2_id, who, BYAHOO_DEFAULT_GROUP );
+ yahoo_add_buddy( yd->y2_id, who, group ? group : BYAHOO_DEFAULT_GROUP );
}
-static void byahoo_remove_buddy( struct gaim_connection *gc, char *who, char *group )
+static void byahoo_remove_buddy( struct im_connection *ic, char *who, char *group )
{
- struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
+ struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
GSList *bgl;
yahoo_remove_buddy( yd->y2_id, who, BYAHOO_DEFAULT_GROUP );
@@ -292,7 +292,7 @@ static void byahoo_remove_buddy( struct gaim_connection *gc, char *who, char *gr
}
}
-static char *byahoo_get_status_string( struct gaim_connection *gc, int stat )
+static char *byahoo_get_status_string( struct im_connection *ic, int stat )
{
enum yahoo_status a = stat >> 1;
@@ -331,42 +331,40 @@ static char *byahoo_get_status_string( struct gaim_connection *gc, int stat )
}
}
-static int byahoo_chat_send( struct conversation *c, char *message )
+static void byahoo_chat_send( struct groupchat *c, char *message, int flags )
{
- struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
+ struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
yahoo_conference_message( yd->y2_id, NULL, c->data, c->title, message, 1 );
-
- return( 0 );
}
-static void byahoo_chat_invite( struct conversation *c, char *msg, char *who )
+static void byahoo_chat_invite( struct groupchat *c, char *msg, char *who )
{
- struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
+ struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg );
}
-static void byahoo_chat_leave( struct conversation *c )
+static void byahoo_chat_leave( struct groupchat *c )
{
- struct byahoo_data *yd = (struct byahoo_data *) c->gc->proto_data;
+ struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data;
yahoo_conference_logoff( yd->y2_id, NULL, c->data, c->title );
serv_got_chat_left( c );
}
-static struct conversation *byahoo_chat_open( struct gaim_connection *gc, char *who )
+static struct groupchat *byahoo_chat_with( struct im_connection *ic, char *who )
{
- struct byahoo_data *yd = (struct byahoo_data *) gc->proto_data;
- struct conversation *c;
+ struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
+ struct groupchat *c;
char *roomname;
YList *members;
- roomname = g_new0( char, strlen( gc->username ) + 16 );
- g_snprintf( roomname, strlen( gc->username ) + 16, "%s-Bee-%d", gc->username, byahoo_chat_id );
+ roomname = g_new0( char, strlen( ic->username ) + 16 );
+ g_snprintf( roomname, strlen( ic->username ) + 16, "%s-Bee-%d", ic->username, byahoo_chat_id );
- c = serv_got_joined_chat( gc, roomname );
- add_chat_buddy( c, gc->username );
+ c = serv_got_joined_chat( ic, roomname );
+ add_chat_buddy( c, ic->username );
/* FIXME: Free this thing when the chat's destroyed. We can't *always*
do this because it's not always created here. */
@@ -380,18 +378,19 @@ static struct conversation *byahoo_chat_open( struct gaim_connection *gc, char *
return c;
}
-void byahoo_init( )
+void byahoo_initmodule( )
{
struct prpl *ret = g_new0(struct prpl, 1);
ret->name = "yahoo";
ret->login = byahoo_login;
- ret->close = byahoo_close;
+ ret->keepalive = byahoo_keepalive;
+ ret->logout = byahoo_logout;
+
ret->send_im = byahoo_send_im;
ret->get_info = byahoo_get_info;
ret->away_states = byahoo_away_states;
ret->set_away = byahoo_set_away;
- ret->keepalive = byahoo_keepalive;
ret->add_buddy = byahoo_add_buddy;
ret->remove_buddy = byahoo_remove_buddy;
ret->get_status_string = byahoo_get_status_string;
@@ -400,26 +399,26 @@ void byahoo_init( )
ret->chat_send = byahoo_chat_send;
ret->chat_invite = byahoo_chat_invite;
ret->chat_leave = byahoo_chat_leave;
- ret->chat_open = byahoo_chat_open;
+ ret->chat_with = byahoo_chat_with;
ret->handle_cmp = g_strcasecmp;
register_protocol(ret);
}
-static struct gaim_connection *byahoo_get_gc_by_id( int id )
+static struct im_connection *byahoo_get_ic_by_id( int id )
{
GSList *l;
- struct gaim_connection *gc;
+ struct im_connection *ic;
struct byahoo_data *yd;
for( l = get_connections(); l; l = l->next )
{
- gc = l->data;
- yd = gc->proto_data;
+ ic = l->data;
+ yd = ic->proto_data;
- if( strcmp( gc->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id )
- return( gc );
+ if( strcmp( ic->acc->prpl->name, "yahoo" ) == 0 && yd->y2_id == id )
+ return( ic );
}
return( NULL );
@@ -440,7 +439,7 @@ void byahoo_connect_callback( gpointer data, gint source, b_input_condition cond
{
struct byahoo_connect_callback_data *d = data;
- if( !byahoo_get_gc_by_id( d->id ) )
+ if( !byahoo_get_ic_by_id( d->id ) )
{
g_free( d );
return;
@@ -462,7 +461,7 @@ gboolean byahoo_read_ready_callback( gpointer data, gint source, b_input_conditi
{
struct byahoo_read_ready_data *d = data;
- if( !byahoo_get_gc_by_id( d->id ) )
+ if( !byahoo_get_ic_by_id( d->id ) )
/* WTF doesn't libyahoo clean this up? */
return FALSE;
@@ -483,7 +482,7 @@ gboolean byahoo_write_ready_callback( gpointer data, gint source, b_input_condit
{
struct byahoo_write_ready_data *d = data;
- if( !byahoo_get_gc_by_id( d->id ) )
+ if( !byahoo_get_ic_by_id( d->id ) )
/* WTF doesn't libyahoo clean this up? */
return FALSE;
@@ -494,10 +493,10 @@ gboolean byahoo_write_ready_callback( gpointer data, gint source, b_input_condit
void ext_yahoo_login_response( int id, int succ, char *url )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
struct byahoo_data *yd = NULL;
- if( gc == NULL )
+ if( ic == NULL )
{
/* libyahoo2 seems to call this one twice when something
went wrong sometimes. Don't know why. Because we clean
@@ -507,11 +506,11 @@ void ext_yahoo_login_response( int id, int succ, char *url )
return;
}
- yd = (struct byahoo_data *) gc->proto_data;
+ yd = (struct byahoo_data *) ic->proto_data;
if( succ == YAHOO_LOGIN_OK )
{
- account_online( gc );
+ account_online( ic );
yd->logged_in = TRUE;
}
@@ -531,7 +530,7 @@ void ext_yahoo_login_response( int id, int succ, char *url )
else if( succ == YAHOO_LOGIN_DUPL )
{
errstr = "Logged in on a different machine or device";
- gc->wants_to_die = TRUE;
+ ic->wants_to_die = TRUE;
}
else if( succ == YAHOO_LOGIN_SOCK )
errstr = "Socket problem";
@@ -550,20 +549,20 @@ void ext_yahoo_login_response( int id, int succ, char *url )
}
if( yd->logged_in )
- hide_login_progress_error( gc, s );
+ hide_login_progress_error( ic, s );
else
- hide_login_progress( gc, s );
+ hide_login_progress( ic, s );
g_free( s );
- signoff( gc );
+ signoff( ic );
}
}
void ext_yahoo_got_buddies( int id, YList *buds )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
- struct byahoo_data *yd = gc->proto_data;
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
+ struct byahoo_data *yd = ic->proto_data;
YList *bl = buds;
while( bl )
@@ -580,7 +579,7 @@ void ext_yahoo_got_buddies( int id, YList *buds )
yd->buddygroups = g_slist_append( yd->buddygroups, bg );
}
- add_buddy( gc, b->group, b->id, b->real_name );
+ add_buddy( ic, b->group, b->id, b->real_name );
bl = bl->next;
}
}
@@ -599,68 +598,68 @@ void ext_yahoo_got_cookies( int id )
void ext_yahoo_status_changed( int id, char *who, int stat, char *msg, int away )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
- serv_got_update( gc, who, stat != YAHOO_STATUS_OFFLINE, 0, 0,
+ serv_got_update( ic, who, stat != YAHOO_STATUS_OFFLINE, 0, 0,
( stat == YAHOO_STATUS_IDLE ) ? away : 0,
( stat != YAHOO_STATUS_AVAILABLE ) | ( stat << 1 ), 0 );
}
void ext_yahoo_got_im( int id, char *who, char *msg, long tm, int stat, int utf8 )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
char *m = byahoo_strip( msg );
- serv_got_im( gc, who, m, 0, 0, strlen( m ) );
+ serv_got_im( ic, who, m, 0, 0, strlen( m ) );
g_free( m );
}
void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg, char *fname, unsigned long fesize )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
- serv_got_crap( gc, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who );
+ serv_got_crap( ic, "Got a file transfer (file = %s) from %s. Ignoring for now due to lack of support.", fname, who );
}
void ext_yahoo_typing_notify( int id, char *who, int stat )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
if (stat == 1) {
/* User is typing */
- serv_got_typing( gc, who, 1, 1 );
+ serv_got_typing( ic, who, 1, 1 );
}
else {
/* User stopped typing */
- serv_got_typing( gc, who, 1, 0 );
+ serv_got_typing( ic, who, 1, 0 );
}
}
void ext_yahoo_system_message( int id, char *msg )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
- serv_got_crap( gc, "Yahoo! system message: %s", msg );
+ serv_got_crap( ic, "Yahoo! system message: %s", msg );
}
void ext_yahoo_webcam_invite( int id, char *from )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
- serv_got_crap( gc, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from );
+ serv_got_crap( ic, "Got a webcam invitation from %s. IRC+webcams is a no-no though...", from );
}
void ext_yahoo_error( int id, char *err, int fatal )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
if( fatal )
{
- hide_login_progress_error( gc, err );
- signoff( gc );
+ hide_login_progress_error( ic, err );
+ signoff( ic );
}
else
{
- do_error_dialog( gc, err, "Yahoo! error" );
+ do_error_dialog( ic, err, "Yahoo! error" );
}
}
@@ -787,7 +786,7 @@ int ext_yahoo_connect(char *host, int port)
static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv )
{
yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name );
- add_chat_buddy( inv->c, inv->gc->username );
+ add_chat_buddy( inv->c, inv->ic->username );
g_free( inv->name );
g_free( inv );
}
@@ -802,7 +801,7 @@ static void byahoo_reject_conf( gpointer w, struct byahoo_conf_invitation *inv )
void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList *members )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
struct byahoo_conf_invitation *inv;
char txt[1024];
YList *m;
@@ -810,34 +809,34 @@ void ext_yahoo_got_conf_invite( int id, char *who, char *room, char *msg, YList
inv = g_malloc( sizeof( struct byahoo_conf_invitation ) );
memset( inv, 0, sizeof( struct byahoo_conf_invitation ) );
inv->name = g_strdup( room );
- inv->c = serv_got_joined_chat( gc, room );
+ inv->c = serv_got_joined_chat( ic, room );
inv->c->data = members;
inv->yid = id;
inv->members = members;
- inv->gc = gc;
+ inv->ic = ic;
for( m = members; m; m = m->next )
- if( g_strcasecmp( m->data, gc->username ) != 0 )
+ if( g_strcasecmp( m->data, ic->username ) != 0 )
add_chat_buddy( inv->c, m->data );
g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", room, who, msg );
- do_ask_dialog( gc, txt, inv, byahoo_accept_conf, byahoo_reject_conf );
+ do_ask_dialog( ic, txt, inv, byahoo_accept_conf, byahoo_reject_conf );
}
void ext_yahoo_conf_userdecline( int id, char *who, char *room, char *msg )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
- serv_got_crap( gc, "Invite to chatroom %s rejected by %s: %s", room, who, msg );
+ serv_got_crap( ic, "Invite to chatroom %s rejected by %s: %s", room, who, msg );
}
void ext_yahoo_conf_userjoin( int id, char *who, char *room )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
- struct conversation *c;
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
+ struct groupchat *c;
- for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
+ for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
if( c )
add_chat_buddy( c, who );
@@ -845,10 +844,10 @@ void ext_yahoo_conf_userjoin( int id, char *who, char *room )
void ext_yahoo_conf_userleave( int id, char *who, char *room )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
- struct conversation *c;
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
+ struct groupchat *c;
- for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
+ for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
if( c )
remove_chat_buddy( c, who, "" );
@@ -856,11 +855,11 @@ void ext_yahoo_conf_userleave( int id, char *who, char *room )
void ext_yahoo_conf_message( int id, char *who, char *room, char *msg, int utf8 )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
char *m = byahoo_strip( msg );
- struct conversation *c;
+ struct groupchat *c;
- for( c = gc->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
+ for( c = ic->conversations; c && strcmp( c->title, room ) != 0; c = c->next );
if( c )
serv_got_chat_in( c, who, 0, m, 0 );
@@ -909,12 +908,12 @@ void ext_yahoo_game_notify( int id, char *who, int stat )
void ext_yahoo_mail_notify( int id, char *from, char *subj, int cnt )
{
- struct gaim_connection *gc = byahoo_get_gc_by_id( id );
+ struct im_connection *ic = byahoo_get_ic_by_id( id );
if( from && subj )
- serv_got_crap( gc, "Received e-mail message from %s with subject `%s'", from, subj );
+ serv_got_crap( ic, "Received e-mail message from %s with subject `%s'", from, subj );
else if( cnt > 0 )
- serv_got_crap( gc, "Received %d new e-mails", cnt );
+ serv_got_crap( ic, "Received %d new e-mails", cnt );
}
void ext_yahoo_webcam_invite_reply( int id, char *from, int accept )
diff --git a/query.c b/query.c
index 40dbb439..c95ff4e1 100644
--- a/query.c
+++ b/query.c
@@ -29,11 +29,11 @@
static void query_display( irc_t *irc, query_t *q );
static query_t *query_default( irc_t *irc );
-query_t *query_add( irc_t *irc, struct gaim_connection *gc, char *question, void *yes, void *no, void *data )
+query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data )
{
query_t *q = g_new0( query_t, 1 );
- q->gc = gc;
+ q->ic = ic;
q->question = g_strdup( question );
q->yes = yes;
q->no = no;
@@ -96,7 +96,7 @@ void query_del( irc_t *irc, query_t *q )
g_free( q );
}
-void query_del_by_gc( irc_t *irc, struct gaim_connection *gc )
+void query_del_by_conn( irc_t *irc, struct im_connection *ic )
{
query_t *q, *n, *def;
int count = 0;
@@ -106,7 +106,7 @@ void query_del_by_gc( irc_t *irc, struct gaim_connection *gc )
while( q )
{
- if( q->gc == gc )
+ if( q->ic == ic )
{
n = q->next;
query_del( irc, q );
@@ -121,7 +121,7 @@ void query_del_by_gc( irc_t *irc, struct gaim_connection *gc )
}
if( count > 0 )
- serv_got_crap( gc, "Flushed %d unanswered question(s) for this connection.", count );
+ serv_got_crap( ic, "Flushed %d unanswered question(s) for this connection.", count );
q = query_default( irc );
if( q && q != def )
@@ -139,12 +139,12 @@ void query_answer( irc_t *irc, query_t *q, int ans )
}
if( ans )
{
- serv_got_crap( q->gc, "Accepted: %s", q->question );
+ serv_got_crap( q->ic, "Accepted: %s", q->question );
q->yes( NULL, q->data );
}
else
{
- serv_got_crap( q->gc, "Rejected: %s", q->question );
+ serv_got_crap( q->ic, "Rejected: %s", q->question );
q->no( NULL, q->data );
}
q->data = NULL;
@@ -157,9 +157,9 @@ void query_answer( irc_t *irc, query_t *q, int ans )
static void query_display( irc_t *irc, query_t *q )
{
- if( q->gc )
+ if( q->ic )
{
- serv_got_crap( q->gc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );
+ serv_got_crap( q->ic, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );
}
else
{
diff --git a/query.h b/query.h
index 2f29a739..b64642c2 100644
--- a/query.h
+++ b/query.h
@@ -28,7 +28,7 @@
typedef struct query
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
char *question;
void (* yes) ( gpointer w, void *data );
void (* no) ( gpointer w, void *data );
@@ -36,9 +36,9 @@ typedef struct query
struct query *next;
} query_t;
-query_t *query_add( irc_t *irc, struct gaim_connection *gc, char *question, void *yes, void *no, void *data );
+query_t *query_add( irc_t *irc, struct im_connection *ic, char *question, void *yes, void *no, void *data );
void query_del( irc_t *irc, query_t *q );
-void query_del_by_gc( irc_t *irc, struct gaim_connection *gc );
+void query_del_by_conn( irc_t *irc, struct im_connection *ic );
void query_answer( irc_t *irc, query_t *q, int ans );
#endif
diff --git a/root_commands.c b/root_commands.c
index ff2d8b37..ee6df91d 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -247,7 +247,7 @@ static void cmd_account( irc_t *irc, char **cmd )
{
irc_usermsg( irc, "Invalid account" );
}
- else if( a->gc )
+ else if( a->ic )
{
irc_usermsg( irc, "Account is still logged in, can't delete" );
}
@@ -268,9 +268,9 @@ static void cmd_account( irc_t *irc, char **cmd )
{
char *con;
- if( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) )
+ if( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) )
con = " (connected)";
- else if( a->gc )
+ else if( a->ic )
con = " (connecting)";
else if( a->reconnect )
con = " (awaiting reconnect)";
@@ -289,7 +289,7 @@ static void cmd_account( irc_t *irc, char **cmd )
{
if( ( a = account_get( irc, cmd[2] ) ) )
{
- if( a->gc )
+ if( a->ic )
{
irc_usermsg( irc, "Account already online" );
return;
@@ -311,7 +311,7 @@ static void cmd_account( irc_t *irc, char **cmd )
irc_usermsg( irc, "Trying to get all accounts connected..." );
for( a = irc->accounts; a; a = a->next )
- if( !a->gc && a->auto_connect )
+ if( !a->ic && a->auto_connect )
account_on( irc, a );
}
else
@@ -328,7 +328,7 @@ static void cmd_account( irc_t *irc, char **cmd )
for( a = irc->accounts; a; a = a->next )
{
- if( a->gc )
+ if( a->ic )
account_off( irc, a );
else if( a->reconnect )
cancel_auto_reconnect( a );
@@ -336,7 +336,7 @@ static void cmd_account( irc_t *irc, char **cmd )
}
else if( ( a = account_get( irc, cmd[2] ) ) )
{
- if( a->gc )
+ if( a->ic )
{
account_off( irc, a );
}
@@ -386,13 +386,13 @@ static void cmd_account( irc_t *irc, char **cmd )
{
set_t *s = set_find( &a->set, set_name );
- if( a->gc && s && s->flags & ACC_SET_OFFLINE_ONLY )
+ if( a->ic && s && s->flags & ACC_SET_OFFLINE_ONLY )
{
g_free( acc_handle );
irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "off" );
return;
}
- else if( !a->gc && s && s->flags & ACC_SET_ONLINE_ONLY )
+ else if( !a->ic && s && s->flags & ACC_SET_ONLINE_ONLY )
{
g_free( acc_handle );
irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "on" );
@@ -449,7 +449,7 @@ static void cmd_add( irc_t *irc, char **cmd )
irc_usermsg( irc, "Invalid account" );
return;
}
- else if( !( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) ) )
+ else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
irc_usermsg( irc, "That account is not on-line" );
return;
@@ -476,27 +476,27 @@ static void cmd_add( irc_t *irc, char **cmd )
/* By making this optional, you can talk to people without having to
add them to your *real* (server-side) contact list. */
if( add_for_real )
- a->gc->acc->prpl->add_buddy( a->gc, cmd[2] );
+ a->ic->acc->prpl->add_buddy( a->ic, cmd[2], NULL );
- add_buddy( a->gc, NULL, cmd[2], cmd[2] );
+ add_buddy( a->ic, NULL, cmd[2], cmd[2] );
- irc_usermsg( irc, "User `%s' added to your contact list as `%s'", cmd[2], user_findhandle( a->gc, cmd[2] )->nick );
+ irc_usermsg( irc, "User `%s' added to your contact list as `%s'", cmd[2], user_findhandle( a->ic, cmd[2] )->nick );
}
static void cmd_info( irc_t *irc, char **cmd )
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
account_t *a;
if( !cmd[2] )
{
user_t *u = user_find( irc, cmd[1] );
- if( !u || !u->gc )
+ if( !u || !u->ic )
{
irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
return;
}
- gc = u->gc;
+ ic = u->ic;
cmd[2] = u->handle;
}
else if( !( a = account_get( irc, cmd[1] ) ) )
@@ -504,19 +504,19 @@ static void cmd_info( irc_t *irc, char **cmd )
irc_usermsg( irc, "Invalid account" );
return;
}
- else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) )
+ else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
irc_usermsg( irc, "That account is not on-line" );
return;
}
- if( !gc->acc->prpl->get_info )
+ if( !ic->acc->prpl->get_info )
{
irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
}
else
{
- gc->acc->prpl->get_info( gc, cmd[2] );
+ ic->acc->prpl->get_info( ic, cmd[2] );
}
}
@@ -551,7 +551,7 @@ static void cmd_rename( irc_t *irc, char **cmd )
}
else if( u->send_handler == buddy_send_handler )
{
- nick_set( u->gc->acc, u->handle, cmd[2] );
+ nick_set( u->ic->acc, u->handle, cmd[2] );
}
irc_usermsg( irc, "Nick successfully changed" );
@@ -563,15 +563,15 @@ static void cmd_remove( irc_t *irc, char **cmd )
user_t *u;
char *s;
- if( !( u = user_find( irc, cmd[1] ) ) || !u->gc )
+ if( !( u = user_find( irc, cmd[1] ) ) || !u->ic )
{
irc_usermsg( irc, "Buddy `%s' not found", cmd[1] );
return;
}
s = g_strdup( u->handle );
- u->gc->acc->prpl->remove_buddy( u->gc, u->handle, NULL );
- nick_del( u->gc->acc, u->handle );
+ u->ic->acc->prpl->remove_buddy( u->ic, u->handle, NULL );
+ nick_del( u->ic->acc, u->handle );
user_del( irc, cmd[1] );
irc_usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );
@@ -582,10 +582,10 @@ static void cmd_remove( irc_t *irc, char **cmd )
static void cmd_block( irc_t *irc, char **cmd )
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
account_t *a;
- if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
+ if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->ic )
{
char *format;
GSList *l;
@@ -596,9 +596,9 @@ static void cmd_block( irc_t *irc, char **cmd )
format = "%-32.32s %-16.16s";
irc_usermsg( irc, format, "Handle", "Nickname" );
- for( l = a->gc->deny; l; l = l->next )
+ for( l = a->ic->deny; l; l = l->next )
{
- user_t *u = user_findhandle( a->gc, l->data );
+ user_t *u = user_findhandle( a->ic, l->data );
irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
}
irc_usermsg( irc, "End of list." );
@@ -608,12 +608,12 @@ static void cmd_block( irc_t *irc, char **cmd )
else if( !cmd[2] )
{
user_t *u = user_find( irc, cmd[1] );
- if( !u || !u->gc )
+ if( !u || !u->ic )
{
irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
return;
}
- gc = u->gc;
+ ic = u->ic;
cmd[2] = u->handle;
}
else if( !( a = account_get( irc, cmd[1] ) ) )
@@ -621,30 +621,30 @@ static void cmd_block( irc_t *irc, char **cmd )
irc_usermsg( irc, "Invalid account" );
return;
}
- else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) )
+ else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
irc_usermsg( irc, "That account is not on-line" );
return;
}
- if( !gc->acc->prpl->add_deny || !gc->acc->prpl->rem_permit )
+ if( !ic->acc->prpl->add_deny || !ic->acc->prpl->rem_permit )
{
irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
}
else
{
- bim_rem_allow( gc, cmd[2] );
- bim_add_block( gc, cmd[2] );
+ bim_rem_allow( ic, cmd[2] );
+ bim_add_block( ic, cmd[2] );
irc_usermsg( irc, "Buddy `%s' moved from your allow- to your block-list", cmd[2] );
}
}
static void cmd_allow( irc_t *irc, char **cmd )
{
- struct gaim_connection *gc;
+ struct im_connection *ic;
account_t *a;
- if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
+ if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->ic )
{
char *format;
GSList *l;
@@ -655,9 +655,9 @@ static void cmd_allow( irc_t *irc, char **cmd )
format = "%-32.32s %-16.16s";
irc_usermsg( irc, format, "Handle", "Nickname" );
- for( l = a->gc->permit; l; l = l->next )
+ for( l = a->ic->permit; l; l = l->next )
{
- user_t *u = user_findhandle( a->gc, l->data );
+ user_t *u = user_findhandle( a->ic, l->data );
irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
}
irc_usermsg( irc, "End of list." );
@@ -667,12 +667,12 @@ static void cmd_allow( irc_t *irc, char **cmd )
else if( !cmd[2] )
{
user_t *u = user_find( irc, cmd[1] );
- if( !u || !u->gc )
+ if( !u || !u->ic )
{
irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
return;
}
- gc = u->gc;
+ ic = u->ic;
cmd[2] = u->handle;
}
else if( !( a = account_get( irc, cmd[1] ) ) )
@@ -680,20 +680,20 @@ static void cmd_allow( irc_t *irc, char **cmd )
irc_usermsg( irc, "Invalid account" );
return;
}
- else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) )
+ else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
irc_usermsg( irc, "That account is not on-line" );
return;
}
- if( !gc->acc->prpl->rem_deny || !gc->acc->prpl->add_permit )
+ if( !ic->acc->prpl->rem_deny || !ic->acc->prpl->add_permit )
{
irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
}
else
{
- bim_rem_block( gc, cmd[2] );
- bim_add_allow( gc, cmd[2] );
+ bim_rem_block( ic, cmd[2] );
+ bim_add_allow( ic, cmd[2] );
irc_usermsg( irc, "Buddy `%s' moved from your block- to your allow-list", cmd[2] );
}
@@ -802,32 +802,32 @@ static void cmd_blist( irc_t *irc, char **cmd )
irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
- for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
+ for( u = irc->users; u; u = u->next ) if( u->ic && u->online && !u->away )
{
if( online == 1 )
{
- g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->acc->prpl->name );
+ g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
irc_usermsg( irc, format, u->nick, s, "Online" );
}
n_online ++;
}
- for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
+ for( u = irc->users; u; u = u->next ) if( u->ic && u->online && u->away )
{
if( away == 1 )
{
- g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->acc->prpl->name );
+ g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
irc_usermsg( irc, format, u->nick, s, u->away );
}
n_away ++;
}
- for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
+ for( u = irc->users; u; u = u->next ) if( u->ic && !u->online )
{
if( offline == 1 )
{
- g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->acc->prpl->name );
+ g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
irc_usermsg( irc, format, u->nick, s, "Offline" );
}
n_offline ++;
@@ -844,15 +844,15 @@ static void cmd_nick( irc_t *irc, char **cmd )
{
irc_usermsg( irc, "Invalid account");
}
- else if( !( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) ) )
+ else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
irc_usermsg( irc, "That account is not on-line" );
}
else if ( !cmd[2] )
{
- irc_usermsg( irc, "Your name is `%s'" , a->gc->displayname ? a->gc->displayname : "NULL" );
+ irc_usermsg( irc, "Your name is `%s'" , a->ic->displayname ? a->ic->displayname : "NULL" );
}
- else if ( !a->prpl->set_info )
+ else if ( !a->prpl->set_my_name )
{
irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
}
@@ -860,7 +860,7 @@ static void cmd_nick( irc_t *irc, char **cmd )
{
irc_usermsg( irc, "Setting your name to `%s'", cmd[2] );
- a->prpl->set_info( a->gc, cmd[2] );
+ a->prpl->set_my_name( a->ic, cmd[2] );
}
}
@@ -878,8 +878,8 @@ static void cmd_qlist( irc_t *irc, char **cmd )
irc_usermsg( irc, "Pending queries:" );
for( num = 0; q; q = q->next, num ++ )
- if( q->gc ) /* Not necessary yet, but it might come later */
- irc_usermsg( irc, "%d, %s(%s): %s", num, q->gc->acc->prpl->name, q->gc->username, q->question );
+ if( q->ic ) /* Not necessary yet, but it might come later */
+ irc_usermsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->username, q->question );
else
irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
}
@@ -887,16 +887,16 @@ static void cmd_qlist( irc_t *irc, char **cmd )
static void cmd_join_chat( irc_t *irc, char **cmd )
{
account_t *a;
- struct gaim_connection *gc;
+ struct im_connection *ic;
char *chat, *channel, *nick = NULL, *password = NULL;
- struct conversation *c;
+ struct groupchat *c;
if( !( a = account_get( irc, cmd[1] ) ) )
{
irc_usermsg( irc, "Invalid account" );
return;
}
- else if( !( a->gc && ( a->gc->flags & OPT_LOGGED_IN ) ) )
+ else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
irc_usermsg( irc, "That account is not on-line" );
return;
@@ -906,7 +906,7 @@ static void cmd_join_chat( irc_t *irc, char **cmd )
irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
return;
}
- gc = a->gc;
+ ic = a->ic;
chat = cmd[2];
if( cmd[3] )
@@ -926,7 +926,7 @@ static void cmd_join_chat( irc_t *irc, char **cmd )
if( cmd[3] && cmd[4] && cmd[5] )
password = cmd[5];
- c = a->prpl->chat_join( gc, chat, nick, password );
+ c = a->prpl->chat_join( ic, chat, nick, password );
g_free( channel );
}
diff --git a/user.c b/user.c
index ff65fe66..232e3a58 100644
--- a/user.c
+++ b/user.c
@@ -140,21 +140,21 @@ user_t *user_find( irc_t *irc, char *nick )
return( NULL );
}
-user_t *user_findhandle( struct gaim_connection *gc, char *handle )
+user_t *user_findhandle( struct im_connection *ic, char *handle )
{
user_t *u;
char *nick;
/* First, let's try a hash lookup. If it works, it's probably faster. */
- if( ( nick = g_hash_table_lookup( gc->acc->nicks, handle ) ) &&
- ( u = user_find( gc->irc, nick ) ) &&
- ( gc->acc->prpl->handle_cmp( handle, u->handle ) == 0 ) )
+ if( ( nick = g_hash_table_lookup( ic->acc->nicks, handle ) ) &&
+ ( u = user_find( ic->irc, nick ) ) &&
+ ( ic->acc->prpl->handle_cmp( handle, u->handle ) == 0 ) )
return u;
/* However, it doesn't always work, so in that case we'll have to dig
through the whole userlist. :-( */
- for( u = gc->irc->users; u; u = u->next )
- if( u->gc == gc && u->handle && gc->acc->prpl->handle_cmp( u->handle, handle ) == 0 )
+ for( u = ic->irc->users; u; u = u->next )
+ if( u->ic == ic && u->handle && ic->acc->prpl->handle_cmp( u->handle, handle ) == 0 )
return u;
return NULL;
diff --git a/user.h b/user.h
index b8896d92..d0a62bdc 100644
--- a/user.h
+++ b/user.h
@@ -37,7 +37,7 @@ typedef struct __USER
char *handle;
char *group;
- struct gaim_connection *gc;
+ struct im_connection *ic;
char *sendbuf;
time_t last_typing_notice;
@@ -53,5 +53,5 @@ typedef struct __USER
user_t *user_add( struct irc *irc, char *nick );
int user_del( irc_t *irc, char *nick );
G_MODULE_EXPORT user_t *user_find( irc_t *irc, char *nick );
-G_MODULE_EXPORT user_t *user_findhandle( struct gaim_connection *gc, char *handle );
+G_MODULE_EXPORT user_t *user_findhandle( struct im_connection *ic, char *handle );
void user_rename( irc_t *irc, char *oldnick, char *newnick );