* might make references to "CC" assuming it's the right one.
*/
become_session(con);
+ logout();
PerformSessionHooks(EVT_STOP);
become_session(NULL);
- /* Now handle all of the administrivia. */
- lprintf(CTDL_DEBUG, "Calling logout(%d)\n", con->cs_pid);
- logout(con);
-
lprintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
/* If the client is still connected, blow 'em away. */
}
else if (!strncasecmp(cmdbuf,"LOUT",4)) {
- if (CC->logged_in) logout(CC);
+ if (CC->logged_in) logout();
cprintf("%d logged out.\n", CIT_OK);
}
/*
* misc things to be taken care of when a user is logged out
*/
-void logout(struct CitContext *who)
+void logout(void)
{
- /*
- * Clear out some session data. Most likely, the CitContext for this
- * session is about to get nuked when the session disconnects, but
- * since it's possible to log in again without reconnecting, we cannot
- * make that assumption.
- */
- strcpy(who->fake_username, "");
- strcpy(who->fake_hostname, "");
- strcpy(who->fake_roomname, "");
- who->logged_in = 0;
-
+ struct CitContext *CCC = CC; /* CachedCitContext - performance boost */
/*
* If there is a download in progress, abort it.
*/
- if (who->download_fp != NULL) {
- fclose(who->download_fp);
- who->download_fp = NULL;
+ if (CCC->download_fp != NULL) {
+ fclose(CCC->download_fp);
+ CCC->download_fp = NULL;
}
/*
* If there is an upload in progress, abort it.
*/
- if (who->upload_fp != NULL) {
- abort_upl(who);
+ if (CCC->upload_fp != NULL) {
+ abort_upl(CCC);
}
/*
* If we were talking to a network node, we're not anymore...
*/
- if (!IsEmptyStr(who->net_node)) {
- network_talking_to(who->net_node, NTT_REMOVE);
+ if (!IsEmptyStr(CCC->net_node)) {
+ network_talking_to(CCC->net_node, NTT_REMOVE);
}
- /* Do modular stuff... */
+ /* Run any hooks registered by modules... */
PerformSessionHooks(EVT_LOGOUT);
+ /*
+ * Clear out some session data. Most likely, the CitContext for this
+ * session is about to get nuked when the session disconnects, but
+ * since it's possible to log in again without reconnecting, we cannot
+ * make that assumption.
+ */
+ strcpy(CCC->fake_username, "");
+ strcpy(CCC->fake_hostname, "");
+ strcpy(CCC->fake_roomname, "");
+ CCC->logged_in = 0;
+
/* Check to see if the user was deleted whilst logged in and purge them if necessary */
- if (who->user.axlevel == 0)
- purge_user(who->user.fullname);
+ if (CCC->user.axlevel == 0)
+ purge_user(CCC->user.fullname);
/* Free any output buffers */
- if (who->output_buffer != NULL) {
+ if (CCC->output_buffer != NULL) {
unbuffer_output();
}
}