Commit 9e1b0ab0 authored by Per Cederqvist's avatar Per Cederqvist

Added create_oldstyle_username.

Fix async_i_am_on that was broken in 1.1.1.
parent 78449f38
Tue Apr 14 17:21:26 1992 Per Cederqvist (ceder@lysator)
* session.c (create_oldstyle_username): New function.
* session.c (pepsi, change_what_am_i_doing, who_is_on,
get_session_info): Use it. (pepsi and change_what_am_i_doing used
to got the username wrong in 1.1.1).
Sat Apr 11 22:00:27 1992 Per Cederqvist (ceder@robin)
* connections.c (check_kill_flag): Small optimization: don't call
......
/*
* $Id: session.c,v 0.10 1992/04/10 11:56:36 ceder Exp $
* $Id: session.c,v 0.11 1992/04/14 15:28:10 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Session control and miscellaneous.
*/
static char *rcsid = "$Id: session.c,v 0.10 1992/04/10 11:56:36 ceder Exp $";
static char *rcsid = "$Id: session.c,v 0.11 1992/04/14 15:28:10 ceder Exp $";
#include <time.h>
......@@ -47,6 +47,26 @@ static char *rcsid = "$Id: session.c,v 0.10 1992/04/10 11:56:36 ceder Exp $";
#include "config.h"
#include "internal-connections.h"
/*
* Create an oldstyle username, user%host.domain@host.domain.
* The RESULT must be initialized to a string (such as EMPTY_STRING).
* A new string will be allocated in RESULT. (The old will be freed).
*/
static void
create_oldstyle_username(String *result,
Connection *connection)
{
if ( s_strcpy(result, cptr->username) != OK )
restart_kom("create_oldstyle_username(): strcpy\n");
if ( s_strcat(result, s_fcrea_str((const unsigned char *)"@")) != OK )
restart_kom("create_oldstyle_username: s_strcat\n");
if ( s_strcat(result, cptr->hostname) != OK )
restart_kom("prot_a_parse_packet: s_strcat II\n");
}
/*
* This function is called whenever a person leaves a conf,
* i e when he pepsi():s or logout():s.
......@@ -309,11 +329,15 @@ pepsi (Conf_no conference)
{
info.person = ACTPERS;
info.what_am_i_doing = active_connection->what_am_i_doing;
info.username = active_connection->username;
info.working_conference = conference;
info.session_no = active_connection->session_no;
/* Bug compatibility. */
create_oldstyle_username(&info.username, active_connection);
async_i_am_on(info);
s_clear(&info.username);
}
return OK;
......@@ -343,16 +367,19 @@ change_what_i_am_doing (String what_am_i_doing)
{
info.person = ACTPERS;
info.what_am_i_doing = active_connection->what_am_i_doing;
info.username = active_connection->username;
create_oldstyle_username(&info.username, active_connection);
info.working_conference = active_connection->cwc;
info.session_no = active_connection->session_no;
async_i_am_on(info);
s_clear(&info.username);
}
return OK;
}
/*
* Get info about what all the currently logged in persons are doing.
*/
......@@ -391,15 +418,7 @@ who_is_on( Who_info_list *result )
/* Backward compatibility: Old clients want the username to be
user%host@host. result->info[i].username is free()d in
prot_a_output_who_info_list() in prot-a-output.c. */
if ( s_strcpy(&result->info[i].username, cptr->username) != OK )
restart_kom("who_is_on(): strcpy\n");
if ( s_strcat(&result->info[i].username,
s_fcrea_str((const unsigned char *)"@")) != OK )
restart_kom("who_is_on: s_strcat\n");
if ( s_strcat(&result->info[i].username, cptr->hostname) != OK )
restart_kom("prot_a_parse_packet: s_strcat II\n");
create_oldstyle_username(&result->info[i].username, cptr);
result->info[ i ].working_conference = cptr->cwc;
result->info[ i ].session_no = cptr->session_no;
......@@ -488,15 +507,7 @@ get_session_info (Session_no session_no,
/* Backward compatibility. result->username is free()d in
prot_a_reply() prot-a.c. */
if (s_strcpy(&result->username ,cptr->username) != OK)
restart_kom("get_session_info(): strcpy.\n");
if ( s_strcat(&result->username,
s_fcrea_str((const unsigned char *)"@")) != OK )
restart_kom("get_session_info: s_strcat\n");
if ( s_strcat(&result->username, cptr->hostname) != OK )
restart_kom("get_session_infot: s_strcat II\n");
create_oldstyle_username(&result->username, cptr);
return OK;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment