Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision 0da65d5fb37691ed4d31f7ab4058732f1440db6b)
+++ protocols/oscar/oscar.c	(revision 552e641194147078c7858059df9916d5d548b7a1)
@@ -263,13 +263,12 @@
 			aim_rxdispatch(odata->sess);
                                if (odata->killme)
-                                       signoff(ic);
+                                       imc_logout(ic);
 		} else {
 			if ((conn->type == AIM_CONN_TYPE_BOS) ||
 				   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
-				hide_login_progress_error(ic, _("Disconnected."));
-				signoff(ic);
+				imc_error(ic, _("Disconnected."));
+				imc_logout(ic);
 			} else if (conn->type == AIM_CONN_TYPE_CHAT) {
 				struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
-				char buf[BUF_LONG];
 				c->conn = NULL;
 				if (c->inpa > 0)
@@ -278,6 +277,5 @@
 				c->fd = -1;
 				aim_conn_kill(odata->sess, &conn);
-				sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
-				do_error_dialog(sess->aux_data, buf, _("Chat Error!"));
+				imc_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name);
 			} else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
 				if (odata->cnpa > 0)
@@ -290,6 +288,5 @@
 						g_slist_remove(odata->create_rooms, cr);
 					g_free(cr);
-					do_error_dialog(sess->aux_data, _("Chat is currently unavailable"),
-							_("Gaim - Chat"));
+					imc_error(sess->aux_data, _("Chat is currently unavailable"));
 				}
 				aim_conn_kill(odata->sess, &conn);
@@ -328,6 +325,6 @@
 
 	if (source < 0) {
-		hide_login_progress(ic, _("Couldn't connect to host"));
-		signoff(ic);
+		imc_error(ic, _("Couldn't connect to host"));
+		imc_logout(ic);
 		return FALSE;
 	}
@@ -356,6 +353,5 @@
 	aim_session_t *sess;
 	aim_conn_t *conn;
-	char buf[256];
-	struct im_connection *ic = new_gaim_conn(acc);
+	struct im_connection *ic = imc_new(acc);
 	struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
 
@@ -382,12 +378,12 @@
 	conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
 	if (conn == NULL) {
-		hide_login_progress(ic, _("Unable to login to AIM"));
-		signoff(ic);
+		imc_error(ic, _("Unable to login to AIM"));
+		imc_logout(ic);
 		return;
 	}
 	
 	if (acc->server == NULL) {
-		hide_login_progress(ic, "No servername specified");
-		signoff(ic);
+		imc_error(ic, "No servername specified");
+		imc_logout(ic);
 		return;
 	}
@@ -395,9 +391,8 @@
 	if (g_strcasecmp(acc->server, "login.icq.com") != 0 &&
 	    g_strcasecmp(acc->server, "login.oscar.aol.com") != 0) {
-		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"), ic->username);
-	set_login_progress(ic, 2, buf);
+		imc_log(ic, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",acc->server);
+	}
+	
+	imc_log(ic, _("Signon: %s"), ic->username);
 
 	aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
@@ -407,6 +402,6 @@
 	conn->fd = proxy_connect(acc->server, AIM_LOGIN_PORT, oscar_login_connect, ic);
 	if (conn->fd < 0) {
-		hide_login_progress(ic, _("Couldn't connect to host"));
-		signoff(ic);
+		imc_error(ic, _("Couldn't connect to host"));
+		imc_logout(ic);
 		return;
 	}
@@ -467,6 +462,6 @@
 
 	if (source < 0) {
-		hide_login_progress(ic, _("Could Not Connect"));
-		signoff(ic);
+		imc_error(ic, _("Could Not Connect"));
+		imc_logout(ic);
 		return FALSE;
 	}
@@ -475,5 +470,5 @@
 	ic->inpa = b_input_add(bosconn->fd, GAIM_INPUT_READ,
 			oscar_callback, bosconn);
-	set_login_progress(ic, 4, _("Connection established, cookie sent"));
+	imc_log(ic, _("Connection established, cookie sent"));
 	
 	return FALSE;
@@ -498,21 +493,21 @@
 		case 0x05:
 			/* Incorrect nick/password */
-			hide_login_progress(ic, _("Incorrect nickname or password."));
+			imc_error(ic, _("Incorrect nickname or password."));
 //			plugin_event(event_error, (void *)980, 0, 0, 0);
 			break;
 		case 0x11:
 			/* Suspended account */
-			hide_login_progress(ic, _("Your account is currently suspended."));
+			imc_error(ic, _("Your account is currently suspended."));
 			break;
 		case 0x18:
 			/* connecting too frequently */
-			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."));
+			imc_error(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(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
+			imc_error(ic, _("The client version you are using is too old. Please upgrade at " WEBSITE));
 			break;
 		default:
-			hide_login_progress(ic, _("Authentication Failed"));
+			imc_error(ic, _("Authentication Failed"));
 			break;
 		}
@@ -526,5 +521,5 @@
 	bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL);
 	if (bosconn == NULL) {
-		hide_login_progress(ic, _("Internal Error"));
+		imc_error(ic, _("Internal Error"));
 		od->killme = TRUE;
 		return 0;
@@ -572,5 +567,5 @@
 	g_free(host);
 	if (bosconn->fd < 0) {
-		hide_login_progress(ic, _("Could Not Connect"));
+		imc_error(ic, _("Could Not Connect"));
 		od->killme = TRUE;
 		return 0;
@@ -610,6 +605,6 @@
 	}
 	if (in != '\n') {
-		do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
-				" You may be disconnected shortly.", "Login Error");
+		imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
+				" You may be disconnected shortly.");
 		b_event_remove(pos->inpa);
 		closesocket(pos->fd);
@@ -633,6 +628,6 @@
 
 	if (source < 0) {
-		do_error_dialog(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
-				" You may be disconnected shortly.", "Login Error");
+		imc_error(pos->ic, "Gaim was unable to get a valid hash for logging into AIM."
+				" You may be disconnected shortly.");
 		if (pos->modname)
 			g_free(pos->modname);
@@ -711,6 +706,6 @@
 			g_free(pos->modname);
 		g_free(pos);
-		do_error_dialog(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
-				" You may be disconnected shortly.", "Login Error");
+		imc_error(sess->aux_data, "Gaim was unable to get a valid hash for logging into AIM."
+				" You may be disconnected shortly.");
 	}
 	pos->fd = fd;
@@ -1210,9 +1205,9 @@
 
 		case 0x0007: { /* Someone has denied you authorization */
-			serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
+			imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
 		} break;
 
 		case 0x0008: { /* Someone has granted you authorization */
-			serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
+			imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
 		} break;
 
@@ -1339,5 +1334,5 @@
 			break;
 	}
-	do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
+	imc_error(sess->aux_data, buf);
 
 	return 1;
@@ -1347,5 +1342,4 @@
 	va_list ap;
 	guint16 reason;
-	char *m;
 
 	va_start(ap, fr);
@@ -1353,8 +1347,6 @@
 	va_end(ap);
 
-	m = g_strdup_printf(_("SNAC threw error: %s\n"),
-			reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
-	do_error_dialog(sess->aux_data, m, _("Gaim - Oscar SNAC Error"));
-	g_free(m);
+	imc_error(sess->aux_data, _("SNAC threw error: %s"),
+	          reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
 
 	return 1;
@@ -1365,5 +1357,4 @@
 	char *destn;
 	guint16 reason;
-	char buf[1024];
 
 	va_start(ap, fr);
@@ -1372,7 +1363,6 @@
 	va_end(ap);
 
-	sprintf(buf, _("Your message to %s did not get sent: %s"), destn,
+	imc_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn,
 			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
-	do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
 
 	return 1;
@@ -1383,5 +1373,4 @@
 	char *destn;
 	guint16 reason;
-	char buf[1024];
 
 	va_start(ap, fr);
@@ -1390,8 +1379,6 @@
 	va_end(ap);
 
-	sprintf(buf, _("User information for %s unavailable: %s"), destn,
+	imc_error(sess->aux_data, _("User information for %s unavailable: %s"), destn,
 			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
-	do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
-
 
 	return 1;
@@ -1409,6 +1396,5 @@
 
 	if (id < 4)
-		do_error_dialog(sess->aux_data, _("Your connection may be lost."),
-				_("AOL error"));
+		imc_error(sess->aux_data, _("Your connection may be lost."));
 
 	return 1;
@@ -1604,6 +1590,6 @@
 		aim_conn_setlatency(fr->conn, windowsize/4);
 	} else if (code == AIM_RATE_CODE_LIMIT) {
-		do_error_dialog(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
-				  "Please wait 10 seconds and try again."), _("Gaim - Error"));
+		imc_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
+			  "Please wait 10 seconds and try again."));
 		aim_conn_setlatency(fr->conn, windowsize/2);
 	} else if (code == AIM_RATE_CODE_CLEARLIMIT) {
@@ -1809,9 +1795,9 @@
 
 		case 0x0007: { /* Someone has denied you authorization */
-			serv_got_crap(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
+			imc_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
 		} break;
 
 		case 0x0008: { /* Someone has granted you authorization */
-			serv_got_crap(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
+			imc_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
 		} break;
 
@@ -1926,5 +1912,5 @@
 
 	if (od->rights.maxawaymsglen == 0)
-		do_error_dialog(ic, "oscar_set_away_aim called before locate rights received", "Protocol Error");
+		imc_error(ic, "oscar_set_away_aim called before locate rights received");
 
 	aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
@@ -1944,5 +1930,5 @@
 		errstr = g_strdup_printf("Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
 
-		do_error_dialog(ic, errstr, "Away Message Too Long");
+		imc_error(ic, errstr);
 
 		g_free(errstr);
@@ -2110,5 +2096,5 @@
 	
 	/* Now that we have a buddy list, we can tell BitlBee that we're online. */
-	account_online(ic);
+	imc_connected(ic);
 	
 	return 1;
@@ -2132,5 +2118,5 @@
 		{
 			/* Hmm, the length should be even... */
-			do_error_dialog( sess->aux_data, "Received SSI ACK package with non-even length", "Gaim - Error" );
+			imc_error( sess->aux_data, "Received SSI ACK package with non-even length");
 			return( 0 );
 		}
@@ -2143,5 +2129,5 @@
 			if( st == 0x0E )
 			{
-				serv_got_crap( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
+				imc_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
 				
 				aim_ssi_auth_request( sess, fr->conn, list, "" );
@@ -2330,5 +2316,5 @@
         }
 
-		serv_got_crap(ic, "%s\n%s", _("User Info"), str->str);
+		imc_log(ic, "%s\n%s", _("User Info"), str->str);
         g_string_free(str, TRUE);
 
@@ -2424,16 +2410,16 @@
 			idletime.tm_sec = 0;
 			strftime(buff, 256, _("%d days %H hours %M minutes"), &idletime);
-			serv_got_crap(ic, "%s: %s", _("Idle Time"), buff);
+			imc_log(ic, "%s: %s", _("Idle Time"), buff);
 		}
 		
 		if(text) {
 			utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
-			serv_got_crap(ic, "%s\n%s", _("User Info"), utf8);
+			imc_log(ic, "%s\n%s", _("User Info"), utf8);
 		} else {
-			serv_got_crap(ic, _("No user info available."));
+			imc_log(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(ic, "%s\n%s", _("Away Message"), utf8);
+		imc_log(ic, "%s\n%s", _("Away Message"), utf8);
 	}
 
