aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/nogaim.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-11-19 16:24:46 +0100
committerJelmer Vernooij <jelmer@samba.org>2005-11-19 16:24:46 +0100
commit9c8ae507985a29b41a22cf30b803141e9ba82a9b (patch)
treee8e96ff2e33512018e7838dfa58983c45a7e0062 /protocols/nogaim.c
parentcc9079ee091707aba3d5b0580a6191eb4541cbec (diff)
parent2cdd8ce76ce334327c84516ff78f3b00bef5bebf (diff)
Merge Wilmer
Diffstat (limited to 'protocols/nogaim.c')
-rw-r--r--protocols/nogaim.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index bf1f52fc..ead86f65 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -183,7 +183,7 @@ int proto_away( struct gaim_connection *gc, char *away )
{
gc->prpl->set_away( gc, s, away );
if( set_getint( gc->irc, "debug" ) )
- irc_usermsg( gc->irc, "Setting away state for %s to %s", gc->prpl->name, s );
+ serv_got_crap( gc, "Setting away state to %s", s );
}
else
gc->prpl->set_away( gc, GAIM_AWAY_CUSTOM, away );
@@ -276,19 +276,19 @@ void destroy_gaim_conn( struct gaim_connection *gc )
void set_login_progress( struct gaim_connection *gc, int step, char *msg )
{
- irc_usermsg( gc->irc, "%s(%s) - Logging in: %s", gc->prpl->name, gc->username, msg );
+ serv_got_crap( gc, "Logging in: %s", msg );
}
/* Errors *while* logging in */
void hide_login_progress( struct gaim_connection *gc, char *msg )
{
- irc_usermsg( gc->irc, "%s(%s) - Login error: %s", gc->prpl->name, gc->username, msg );
+ serv_got_crap( gc, "Login error: %s", msg );
}
/* Errors *after* logging in */
void hide_login_progress_error( struct gaim_connection *gc, char *msg )
{
- irc_usermsg( gc->irc, "%s(%s) - Logged out: %s", gc->prpl->name, gc->username, msg );
+ serv_got_crap( gc, "Logged out: %s", msg );
}
void serv_got_crap( struct gaim_connection *gc, char *format, ... )
@@ -307,8 +307,8 @@ void serv_got_crap( struct gaim_connection *gc, char *format, ... )
else
msg = text;
- /* if( g_strcasecmp( set_getstr(gc->irc, "html" ), "strip" ) == 0 ) */
- if( gc->flags & OPT_CONN_HTML )
+ if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||
+ ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )
strip_html( msg );
irc_usermsg( gc->irc, "%s(%s) - %s", gc->prpl->name, gc->username, msg );
@@ -336,7 +336,7 @@ void account_online( struct gaim_connection *gc )
u = user_find( gc->irc, gc->irc->nick );
- irc_usermsg( gc->irc, "%s(%s) - Logged in", gc->prpl->name, gc->username );
+ serv_got_crap( gc, "Logged in" );
gc->keepalive = g_timeout_add( 60000, send_keepalive, gc );
gc->flags |= OPT_LOGGED_IN;
@@ -350,7 +350,7 @@ void account_online( struct gaim_connection *gc )
break;
if( u == NULL )
- irc_usermsg( gc->irc, "\x02""***\x02"" BitlBee now supports ICQ server-side contact lists. "
+ serv_got_crap( gc, "\x02""***\x02"" BitlBee now supports ICQ server-side contact lists. "
"See \x02""help import_buddies\x02"" for more information." );
}
}
@@ -383,7 +383,7 @@ void signoff( struct gaim_connection *gc )
user_t *t, *u = irc->users;
account_t *a;
- irc_usermsg( gc->irc, "%s(%s) - Signing off..", gc->prpl->name, gc->username );
+ serv_got_crap( gc, "Signing off.." );
gaim_input_remove( gc->keepalive );
gc->keepalive = 0;
@@ -415,7 +415,7 @@ void signoff( struct gaim_connection *gc )
else if( !gc->wants_to_die && set_getint( irc, "auto_reconnect" ) )
{
int delay = set_getint( irc, "auto_reconnect_delay" );
- irc_usermsg( gc->irc, "%s(%s) - Reconnecting in %d seconds..", gc->prpl->name, gc->username, delay);
+ serv_got_crap( gc, "Reconnecting in %d seconds..", delay );
a->reconnect = 1;
g_timeout_add( delay * 1000, auto_reconnect, a );
@@ -429,7 +429,7 @@ void signoff( struct gaim_connection *gc )
void do_error_dialog( struct gaim_connection *gc, char *msg, char *title )
{
- irc_usermsg( gc->irc, "%s(%s) - Error: %s", gc->prpl->name, gc->username, msg );
+ serv_got_crap( gc, "Error: %s", msg );
}
void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont )
@@ -458,12 +458,12 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea
irc_t *irc = gc->irc;
if( set_getint( irc, "debug" ) && 0 ) /* This message is too useless */
- irc_usermsg( irc, "Receiving user add from protocol: %s", handle );
+ serv_got_crap( gc, "Receiving user add from handle: %s", handle );
if( user_findhandle( gc, handle ) )
{
if( set_getint( irc, "debug" ) )
- irc_usermsg( irc, "User already exists, ignoring add request: %s", handle );
+ serv_got_crap( gc, "User already exists, ignoring add request: %s", handle );
return;
@@ -556,7 +556,7 @@ void serv_buddy_rename( struct gaim_connection *gc, char *handle, char *realname
u->realname = g_strdup( name );
if( ( gc->flags & OPT_LOGGED_IN ) && set_getint( gc->irc, "display_namechanges" ) )
- irc_usermsg( gc->irc, "User `%s' changed name to `%s'", u->nick, u->realname );
+ serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname );
}
}
@@ -589,8 +589,8 @@ void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, in
{
if( set_getint( gc->irc, "debug" ) || g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "ignore" ) != 0 )
{
- irc_usermsg( gc->irc, "serv_got_update() for handle %s on connection %s(%s):", handle, gc->prpl->name, gc->username );
- irc_usermsg( gc->irc, "loggedin = %d, type = %d", loggedin, type );
+ serv_got_crap( gc, "serv_got_update() for handle %s:", handle );
+ serv_got_crap( gc, "loggedin = %d, type = %d", loggedin, type );
}
return;
@@ -670,7 +670,7 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
if( g_strcasecmp( h, "ignore" ) == 0 )
{
if( set_getint( irc, "debug" ) )
- irc_usermsg( irc, "Ignoring message from unknown handle %s on connection %s(%s)", handle, gc->prpl->name, gc->username );
+ serv_got_crap( gc, "Ignoring message from unknown handle %s", handle );
return;
}
@@ -692,13 +692,13 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
}
else
{
- irc_usermsg( irc, "Message from unknown handle %s on connection %s(%s):", handle, gc->prpl->name, gc->username );
+ serv_got_crap( gc, "Message from unknown handle %s:", handle );
u = user_find( irc, irc->mynick );
}
}
- /* if( g_strcasecmp( set_getstr( irc, "html" ), "strip" ) == 0 ) */
- if( gc->flags & OPT_CONN_HTML )
+ if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||
+ ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )
strip_html( msg );
if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 &&
@@ -752,7 +752,7 @@ void serv_got_chat_left( struct gaim_connection *gc, int id )
GList *ir;
if( set_getint( gc->irc, "debug" ) )
- irc_usermsg( gc->irc, "You were removed from conversation %d", (int) id );
+ serv_got_crap( gc, "You were removed from conversation %d", (int) id );
for( c = gc->conversations; c && c->id != id; c = (l=c)->next );
@@ -797,8 +797,8 @@ void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whispe
u = user_findhandle( gc, who );
for( c = gc->conversations; c && c->id != id; c = c->next );
- /* if( g_strcasecmp( set_getstr( gc->irc, "html" ), "strip" ) == 0 ) */
- if( gc->flags & OPT_CONN_HTML )
+ if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||
+ ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )
strip_html( msg );
if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&
@@ -808,7 +808,7 @@ void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whispe
if( c && u )
irc_privmsg( gc->irc, u, "PRIVMSG", c->channel, "", msg );
else
- irc_usermsg( gc->irc, "Message from/to conversation %s@%d (unknown conv/user): %s", who, id, msg );
+ serv_got_crap( gc, "Message from/to conversation %s@%d (unknown conv/user): %s", who, id, msg );
}
struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle )
@@ -831,12 +831,12 @@ struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, c
c->title = g_strdup( handle );
s = g_new( char, 16 );
- sprintf( s, "#chat_%03d", gc->irc->c_id++ );
+ sprintf( s, "&chat_%03d", gc->irc->c_id++ );
c->channel = g_strdup( s );
g_free( s );
if( set_getint( gc->irc, "debug" ) )
- irc_usermsg( gc->irc, "Creating new conversation: (id=%d,handle=%s)", id, handle );
+ serv_got_crap( gc, "Creating new conversation: (id=%d,handle=%s)", id, handle );
return( c );
}
@@ -855,7 +855,7 @@ void add_chat_buddy( struct conversation *b, char *handle )
int me = 0;
if( set_getint( b->gc->irc, "debug" ) )
- irc_usermsg( b->gc->irc, "User %s added to conversation %d", handle, b->id );
+ serv_got_crap( b->gc, "User %s added to conversation %d", handle, b->id );
/* It might be yourself! */
if( b->gc->prpl->cmp_buddynames( handle, b->gc->user->username ) == 0 )
@@ -889,7 +889,7 @@ void remove_chat_buddy( struct conversation *b, char *handle, char *reason )
int me = 0;
if( set_getint( b->gc->irc, "debug" ) )
- irc_usermsg( b->gc->irc, "User %s removed from conversation %d (%s)", handle, b->id, reason ? reason : "" );
+ serv_got_crap( b->gc, "User %s removed from conversation %d (%s)", handle, b->id, reason ? reason : "" );
/* It might be yourself! */
if( g_strcasecmp( handle, b->gc->user->username ) == 0 )
@@ -1030,10 +1030,15 @@ int serv_send_im( irc_t *irc, user_t *u, char *msg, int flags )
do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 )
msg = buf;
- if( u->gc->flags & OPT_CONN_HTML) {
- char * html = escape_html(msg);
- strncpy(buf, html, 8192);
- g_free(html);
+ if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+ {
+ char *html;
+
+ html = escape_html( msg );
+ strncpy( buf, html, 8192 );
+ g_free( html );
+
+ msg = buf;
}
return( ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags ) );