コード例 #1
0
ファイル: input.c プロジェクト: esseye/bsflite-otr
/* PROTO */
void
input_quit(char *arg)
{
    struct ConnPtr *trav, *temp;

    restore_tty();

    if (conn->otr) {
        printf("\n");
        otr_cleanup();
    }

    log_buddies_offline();

    imcomm_delete_handle_now(conn->conn);

    if (conn->clist->conn == conn->conn) {
        temp = conn->clist;
        conn->clist = conn->clist->next;

        if (temp->username)
            free(temp->username);

        free(temp);
    } else {
        for (trav = conn->clist; trav->next;) {
            if (trav->next->conn == conn->conn) {
                temp = trav->next;
                trav->next = trav->next->next;

                if (temp->username)
                    free(temp->username);

                free(temp);
            }
        }
    }

    delete_buddylist(buddylist);

    if (conn->username)
        free(conn->username);

    if (conn->password)
        free(conn->password);

    if (conn->awaymsg)
        free(conn->awaymsg);

    if (conn->lastsn)
        free(conn->lastsn);

    free(conn);

    printf("\n");

    exit(0);
}
コード例 #2
0
ファイル: AIM.cpp プロジェクト: Barrett17/Caya
status_t
AIMProtocol::LogOff()
{
	fOnline = false;
	imcomm_delete_handle_now(fIMCommHandle);
	BString content(fUsername);
	content << " has logged out!";
	_Notify(B_INFORMATION_NOTIFICATION, "Disconnected",
			content.String());

	return B_OK;
}
コード例 #3
0
ファイル: input.c プロジェクト: blacRose/bsfliterm
/* PROTO */
void
input_reconnect(char *arg)
{
	struct ConnPtr *temp, *trav;

	eraseline();
	b_echostr_s();

	if (conn->timestamps) {
		addts();
		putchar(' ');
	}
	if (arg[0] != '\0') {
		if (conn->username) {
			free(conn->username);
			conn->username = NULL;
		}
		if (conn->password) {
			free(conn->password);
			conn->password = NULL;
		}
		printf("Reconnecting as %s...\n", arg);

		conn->username = strdup(arg);
		b_getpassword();
	} else {
		printf("Reconnecting...\n");
	}

	if (conn->conn != NULL) {

		delete_buddylist(buddylist);

		buddylist = NULL;
		conn->buddiesonline = 0;

		if (conn->clist->conn == conn->conn) {
			temp = conn->clist;
			conn->clist = conn->clist->next;
			if (temp->username)
				free(temp->username);

			free(temp);
		} else {
			for (trav = conn->clist; trav->next;) {
				if (trav->next->conn == conn->conn) {
					temp = trav->next;
					trav->next = trav->next->next;

					if (temp->username)
						free(temp->username);

					free(temp);
				}
			}
		}

		imcomm_delete_handle_now(conn->conn);

		conn->conn = NULL;
	}
	create_new_connection();

	if (conn->proxytype != PROXY_TYPE_NONE) {
		imcomm_set_proxy(conn->clist->conn, conn->proxytype, conn->proxy,
				 (uint16_t) conn->proxyport);
	}
	if (conn->oscarport != 0) {
		imcomm_set_oscar_port(conn->clist->conn, conn->oscarport);
	}
	imcomm_im_signon(conn->clist->conn, conn->username, conn->password);
	conn->conn = conn->clist->conn;

	if (conn->isaway)
		imcomm_set_away(conn->conn, conn->awaymsg);
}