示例#1
0
文件: numeric.c 项目: ranauei/melabot
static void numeric_userhost(struct socket_info *sinfo, char *data)
{
	struct userlist *user;
	clientinfo client;
	char *tmp;

	strip_char_from_end('\r', data);

	tmp = strtok(data, " ");

	client.nick = strtok(NULL, "=");
	strip_char_from_end(':', client.nick);
	//not in mela
	strip_char_from_end('*', client.nick);

	client.ident = strtok(NULL, "@");
	strip_char_from_end('+', client.ident);

	client.address = client.address = strtok(NULL, " ");

	client.server = GetServerBySocket(sinfo);

	user = UpdateUser(&client);
	UpdateAccess(user, NULL);
}
示例#2
0
void CStatistic::UpdateUser()
{
    std::vector<std::string> usernames;
    mysqlOp->QueryAllUser(usernames);

    for (int i = 0; i < usernames.size(); i ++) 
    {
        UpdateUser(usernames[i]);
    }
}
示例#3
0
void BattleroomListCtrl::UpdateUser( User& user )
{
    if ( !user.BattleStatus().spectator )
		icons().SetColourIcon( user.BattleStatus().colour );
    wxArrayString sides = LSL::Util::vectorToArrayString(LSL::usync().GetSides(STD_STRING(m_battle->GetHostModName())));
    ASSERT_EXCEPTION( user.BattleStatus().side < (long)sides.GetCount(), _T("Side index too high") );
    user.SetSideiconIndex( icons().GetSideIcon( m_battle->GetHostModName(), user.BattleStatus().side ) );
    int index = GetIndexFromData( &user );
    UpdateUser( index );
}
void BattleroomListCtrl::AddUser(User& user)
{
	//first time setting is necessary to have color in replay/savegame used controls
	if (!user.BattleStatus().spectator) {
		icons().SetColourIcon(user.BattleStatus().colour);
		UpdateUser(user);
	}
	if (AddItem(&user))
		return;

	wxLogWarning(_T("user already in battleroom list."));
}
void BattleroomListCtrl::UpdateUser(User& user)
{
	if (!user.BattleStatus().spectator)
		icons().SetColourIcon(user.BattleStatus().colour);
	try {
		wxArrayString sides = lslTowxArrayString(LSL::usync().GetSides(m_battle->GetHostModName()));
		if (user.BattleStatus().side < (long)sides.GetCount()) {
			user.SetSideiconIndex(icons().GetSideIcon(m_battle->GetHostModName(), user.BattleStatus().side));
		}
	} catch (...) {
	}
	int index = GetIndexFromData(&user);
	UpdateUser(index);
}
示例#6
0
void BattleRoomTab::OnUnitsyncReloaded(wxCommandEvent& /*data*/)
{
	if (!m_battle)
		return;
	//m_minimap->UpdateMinimap();//should happen automagically now
	RegenerateOptionsList();
	ReloadMaplist();
	UpdateBattleInfo();

	const size_t count = m_battle->GetNumUsers();
	for (size_t i = 0; i < count; i++) {
		UpdateUser(m_battle->GetUser(i));
	}
	m_battle->SendMyBattleStatus(); // This should reset sync status.
	ui().DownloadArchives(*m_battle);
}
示例#7
0
void BattleRoomTab::OnUserJoined( User& user )
{
	if ( !m_battle ) return;
	if ( !user.BattleStatus().IsBot() ) m_chat->Joined( user );
	m_players->AddUser( user );

	UpdateUser(user);

	if ( &user == &m_battle->GetMe() )
	{
		m_players->SetSelectedIndex ( m_players->GetIndexFromData( &user ) );
	}
	UpdateStatsLabels();

	UiEvents::GetStatusEventSender( UiEvents::addStatusMessage ).SendEvent(UiEvents::StatusData( wxFormat(_("%s joined your active battle") ) % user.GetNick(), 1 ) );
}
示例#8
0
int LoginUser(MYSQL *conn, char *userName, char *userPasswd)
{
    int id;
    char passwd[20];
    char email[50];
    int online;
    char *instruction;
    QueryUserByName(conn, &id, userName, passwd, email, &online);
    if(strcmp(passwd, userPasswd) == 0){
	if(id > 0)// && strcmp(passwd, userPasswd) == 0)
	{
	    UpdateUser(conn, id, NULL, NULL, NULL, TRUE);
	    return id;
	}
	else
	    return -1;   
    }
    else
	return -1;
}
// Вход в чат.
void OnUserConnect(BYTE *InBuffer) {
	String name, ip, query;
	DWORD male;

	try {
		//name
		GetStreamString(&InBuffer, &name);
		//ip
		GetStreamString(&InBuffer, &ip);
		//male
		GetStreamDword(&InBuffer, &male);

		// Get user from registred users list, add it's reference to online users and update user info.
		UsersList::iterator user = FindUserByName(name);
		CFUserInfo user_info = GetUserInfo(name);
		OnlineUsersList::iterator online_user = AddOnlineUser(user, user_info.state, user_info.client_version, user_info.process, user_info.window_activity, user_info.downtime);
		UpdateUser(user, user_info.computer_id, user_info.ip, user_info.male);

		// If user is in authorization queue.
		AuthQueueMap::iterator auth_queue_item = FindAuthQueueByUser(name);
		if (IsAuthQueueElement(auth_queue_item)) {
			LogicalConnections::iterator connection = GetAuthQueueConnection(auth_queue_item);
			SetConnectionUser(connection, online_user);
			SetAuthorizationStatus(connection, 9);
			DeleteAuthQueueItem(auth_queue_item);
		}

		MapList params;
		params.insert(pair<String, String>("name", name));
		params.insert(pair<String, String>("ip", ip));
		params.insert(pair<String, String>("sex", male));

		String json_object = SetParametersObject(params, true);
		SendNotification("user_connect", json_object, GetConnectionsRef(true));
	} catch (Exception *E) {
		throw(Format(e_user_connect, ARRAYOFCONST((E->Message))));
	}
}
示例#10
0
void main( int argc, char *argv[] ) {
  cout << " Confy V" << Confy_Version << "." << Confy_Revision
       << " --- Copyright 1999 TM Productions" << endl;

  if( argc < 4 )
    Help();

  if( argv[1][0] == '?' )
    Help();

  // Argument Tests
  char * dest = argv[1];
  char * user = argv[2];
  bool   plugins_only = false;

  bool   use_executable = false;
  char   executable[ MAX_PATH_LENGTH ] = "";

  bool   use_dash_c = false;
  char   dash_c[ MAX_PATH_LENGTH ] = "-c";   // Oddly enough, this is correct (ie: "-clw.cfg").  Weird.

  bool   use_flags = false;
  char   flags[ 1024 ] = "";

  bool   use_scene = false;
  char   scene[ MAX_PATH_LENGTH ] = "";

  bool   stop = false;
  for( int first_plugin_cfg = 3; first_plugin_cfg < argc; first_plugin_cfg++ ) {
    switch( argv[first_plugin_cfg][1] ) {
    // Specify Config Path for Layout
    case 'c':
      if( ++first_plugin_cfg >= argc ) {
        cerr << " ERROR: No config file following arguemnt -c!" << endl;
        cerr << " Type Confy ? for help" << endl;
        exit(20);
      }

      use_dash_c = true;
      strcat( dash_c, argv[ first_plugin_cfg ] );

      if( !DirInfo::Exists( argv[ first_plugin_cfg ] ) ) {
        cerr << " ERROR: The -c config file \"" << dash_c << "\" doesn't exist!" << endl;
        cerr << " Type Confy ? for help" << endl;
        exit(20);
      }
      break;

    // Executable
    case 'e':
      if( ++first_plugin_cfg >= argc ) {
        cerr << " ERROR: No executable following argument -e!" << endl;
        cerr << " Type Confy ? for help" << endl;
        exit(20);
      }

      use_executable = true;
      strcpy( executable, argv[ first_plugin_cfg ] );

      if( !DirInfo::Exists( executable ) ) {
        cerr << " ERROR: The executable \"" << executable << "\" doesn't exist!" << endl;
        cerr << " Type Confy ? for help" << endl;
        exit(20);
      }
      break;

    // Flags
    case 'f':
      if( ++first_plugin_cfg >= argc ) {
        cerr << " ERROR: No flags following argument -f!" << endl;
        cerr << " Type Confy ? for help" << endl;
        exit(20);
      }

      use_flags = true;
      strcpy( flags, argv[ first_plugin_cfg ] );

    // Plug-ins Only
    case 'p':
      plugins_only = true;
      break;

    // Scene/Object to pass to Lightwave/Modeler on load
    case 's':
      if( ++first_plugin_cfg >= argc ) {
        cerr << " ERROR: No scene/object file following argument -s!" << endl;
        cerr << " Type Confy ? for help" << endl;
        exit(20);
      }

      use_scene = true;
      strcpy( scene, argv[ first_plugin_cfg ] );

      break;

    // End of options
    default:                   // This is probably the first plugin config file
      stop = true;
      break;
    }

    if( stop )
      break;
  }

  // Test Arguments For Validity
  if( first_plugin_cfg >= argc ) {
    cerr << " ERROR: No plug-in configs specified!" << endl;
    cerr << " Type Confy ? for help" << endl;
    exit( 20 );
  }

  if( use_scene && !use_executable ) {
    cerr << " ERROR:  using -s requires -e" << endl;
    cerr << " Type Confy ? for help" << endl;
    exit(20);
  }

  // Display Settings
  cout << "-Settings:" << endl;
  cout << "  Destination Config:             \"" << dest << "\"" << endl;
  cout << "  User Config:                    \"" << user << "\"" << endl;

  if( plugins_only )
    cout << "  Adding plug-ins only; no settings will be replaced" << endl;

  if( use_executable )
    cout << "  Executable to launch:           \"" << executable << "\"" << endl;

  if( use_scene )
    cout << "  Scene to load into Lightwave:   \"" << scene << "\"" << endl;

  cout << "  Settings and Plug-In Config 0:  \"" << argv[ first_plugin_cfg ] << "\"" << endl;
  for( int i = first_plugin_cfg+1; i < argc; i++ ) 
    cout << "  Plug-In Config " << i-first_plugin_cfg << ":               \"" << argv[ i ] << "\"" << endl;

  // Config Variable Setup
  DynArray< char * >   settings[ num_settings_group_ids ];
  char                 buffer[ 8192 ];
  char               * plugin_type;
  char               * new_name, * old_name;
  unsigned int         j;
  pifstream            in;
  bool                 error = false;
  
  config_type_ids      cfg_type = config_unknown, new_type;
  int                  cfg_version = -1, new_version;
  DynArray< char * > * user_settings_loc = &settings[ user_settings_pre ];

  // ---
  // Load the User Config Settings
  // ---
  try {
    cout << "-Loading User Config..." << endl;
    cfg_type = OpenConfig( user, in );
    if( cfg_type != config_unknown ) {
      cfg_version = GetConfigVersion( in, cfg_type );
      if( cfg_version == -1 )
        throw false;
    }

    if( cfg_type == config_layout ) {
      cout << " User config file is a Layout config, version " << cfg_version << endl;
    } else if( cfg_type == config_modeler ) {
      cout << " User config file is a Modeler config, version " << cfg_version << endl;
    } else {
      cout << " Unknown config file type; L6 config?" << endl;
    }

    while( true ) {
      // Read in a new line
      in.getline( buffer, 8192 );

      // Error Test
      if( (in.fail() || in.bad()) && !in.eof() ) {
        cerr << " ERROR:  File error reading from user config file; aborting" << endl;
        throw false;
      }

      // See if there are any plug-ins here and skip them
      if( strncmp( "Plugin ", buffer, 7 ) == 0 ) {
        user_settings_loc = &settings[ user_settings_post ];
      } else {
        // Add the prev. line to the appropriate array
        user_settings_loc->Add( strdup( buffer ) );
      }

      // EOF test
      if( in.eof() )
        break;
    };

    // ---
    // Load the Plug-In Configs
    // ---
    user_settings_loc = &settings[ user_settings_pre ];
    for( int k=first_plugin_cfg; k < argc; k++ ) {
      cout << "-Loading Plugin Config " << k - first_plugin_cfg << ":  \"" << argv[k] << "\"..." << endl;

      in.close();
      new_type = OpenConfig( argv[ k ], in );
      if( new_type == config_bad ) {
        cerr << " ERROR:  Error opening config file; aborting" << endl;
        throw false;
      } else if( new_type == config_unknown ) {
        if( cfg_type != new_type ) {
          cerr << " ERROR:  Attempting to merge unknown config file (not a .cfg?); aborting" << endl;
          throw false;
        }
      } else if( new_type != cfg_type ) {
        cerr << " ERROR:  Illegal attempt to merge Modeler and Layout configs file; aborting" << endl;
        throw false;
      }

      if( new_type != config_unknown ) {
        new_version = GetConfigVersion( in, cfg_type );
        if( cfg_version != new_version ) {
          cerr << " ERROR:  The configuration files are not the same version; aborting" << endl;
          throw false;
        }
      }

      while( true ) {
        // Read in a new line
        in.getline( buffer, 8192 );

        // Error Test
        if( (in.fail() || in.bad()) && !in.eof() ) {
          cerr << " ERROR:  File error reading from plug-in config file \""
               << argv[ k ] << "\"; aborting" << endl;
          throw false;
        }

        // Update the user config options
        if( !plugins_only && (k == first_plugin_cfg) )
          UpdateUser( buffer, *user_settings_loc, cfg_type );

        // See if there's a plug-in here and store it
        if( strncmp( "Plugin ", buffer, 7 ) == 0 ) {           // The space is so we don't confuse this with 
          user_settings_loc = &settings[ user_settings_post ];

          plugin_type = StringTools::FindWord( buffer, 1 );
          if( plugin_type == NULL ) {
            cerr << " WARNING:  Missing plug-in identifier after keyword \"" << buffer
                 << "\" (config " << k - first_plugin_cfg << ")" << endl;
          } else {
            for( i = 0; i < num_plugin_ids; i++ ) {
              // Figure out what group it's in
              if( strncmp( plugin_type, settings_group_strings[i], strlen( settings_group_strings[i] ) ) == 0 ) {
                break;
              }
            }

            // Test for unknown plug-in types
            if( i == num_plugin_ids ) {
              cerr << " WARNING:  Unknown plug-in type found in this line: \"" << buffer
                   << "\" (config " << k - first_plugin_cfg << ")" << endl;
              settings[ plugins_other ].Add( strdup( buffer ) );
            }

            // See if this plug-in is a duplicate
            new_name = StringTools::FindWord( buffer, 2 );         // This should be the name of the plug-in as found in the .p file
            if( new_name == NULL ) {
              cerr << " WARNING:  The following line contains invalid plug-in information: \"" << buffer
                    << "\" (config " << k - first_plugin_cfg << ")" << endl;
            } else {
              for( j=0; j < settings[i].NumElements(); j++ ) {
                old_name = StringTools::FindWord( settings[i][j], 2 );
                if( old_name == NULL ) {
                  cerr << " WARNING:  The following plug-in line is invalid \"" << buffer << "\"; skipping";
                } else {
                  if( strncmp( old_name, new_name, StringTools::FindWordLength( old_name ) ) == 0 ) {
                    if( StringTools::FindWordLength( old_name ) == StringTools::FindWordLength( new_name ) ) {  // make sure the words are equal length; gets around strncmp() failing on things like "Metaform_Shaper" and "Metaform_Shaper(FASTER)"
                      cerr << " WARNING:  The following plug-in is already in the config: \"" << buffer
                           << "\"; replacing existing with this (config " << k - first_plugin_cfg << ")" << endl;
                      delete settings[i][j];
                      settings[i][j] = strdup( buffer );
                      break;
                    }
                  }
                }
              }

              // Not a duplicate; add it to the end
              if( j == settings[i].NumElements() ) {
                settings[i].Add( strdup( buffer ) );
              }
            }

          }
        }

        // EOF test
        if( in.eof() )
          break;
      };
    }

    in.close();

    // ---
    // Backup the existing config, if needed
    // ---
    if( DirInfo::Exists( dest ) ) {
      char backup[ MAX_PATH_LENGTH ];
      char extension[ MAX_FILENAME_LENGTH ];

      // Generate the backup name
      strcpy( backup, dest );
      char * ext = DirStrings::HasExtension( backup ); // Find any extension
      if( ext ) {                                      // Strip the extension
        strcpy( extension, ext );
        *ext = '\0';
      }
      strcat( backup, "-backup" );                     // Append "-backup"
      strcat( backup, extension );                     // Put the extension back

      cout << "-Destination configs already exists; backing up original as \"" << backup << "\"" << endl;

      // Delete any existing backup file so we can rename this one
      if( DirInfo::Exists( backup ) ) {
        if( DirInfo::Delete( backup ) != DI_DELETE_OK ) {
          cerr << " ERROR:  Unable to remove previously existing backup; aborting" << endl;
          throw false;
        }
      }

      // Rename the existing config
      if( DirInfo::Rename( dest, backup ) != DI_RENAME_OK ) {
        cerr << " ERROR:  Unable to rename existing config as backup; aborting" << endl;
        throw false;
      }
    }


    // ---
    // Output the final config
    // ---
    cout << "-Writing Composite Config \"" << dest << "\"..." << endl;
    ofstream out( dest );
    if( !out ) {
      cerr << " ERROR:  Unable to open output config \"" << dest << "\"; aborting" << endl;
      throw false;
    }

    // Pre-Plugin Settings
    for( j = 0; j < settings[ user_settings_pre ].NumElements(); j++ ) {
      if( settings[ user_settings_pre ][j][0] != '\0' )   // Skip any possible blank lines
        out << settings[ user_settings_pre ][j] << endl;
    }

    // Plug-ins
    for( i = 0; i < num_plugin_ids; i++ ) {
      for( j = 0; j < settings[i].NumElements(); j++ )
        out << settings[i][j] << endl;
    }

    // Post-Plugin Settings
    for( j = 0; j < settings[ user_settings_post ].NumElements(); j++ ) {
      if( settings[ user_settings_post ][j][0] != '\0' )   // Skip any possible blank lines
        out << settings[ user_settings_post ][j] << endl;
    }

  } catch( bool ) {
    error = true;  // We're just here so the clean-up code gets called on errors
  }

  // Free the memory used by the strings
  if( !error )
    cout << "-Cleaning up..." << endl;
  for( i=0; i < num_settings_group_ids; i++ ) {
    for( j = 0; j < settings[i].NumElements(); j++ )
      free( settings[i][j] );
  }

  if( !error ) {
    if( use_executable ) {
      cout << "-Launching \"" << executable << "\"..." << endl;

      // Change the working dir
      char cwd[ MAX_PATH_LENGTH ];
      strcpy( cwd, executable );
      *DirStrings::HasFile( cwd ) = '\0';
      if( cwd[0] != '\0' )
        DirInfo::ChangeWorkingDir( cwd );

      // Build the argument list
      char *exec_args[128];
      int a1 = 0;
      exec_args[ a1++ ] = strdup( DirStrings::GetFilePart( executable ) );

      if( use_dash_c )           // -c option
        exec_args[ a1++ ] = strdup( dash_c );

      if( use_flags ) {          // User-defined flags
        int j = 0;
        strcpy( buffer, flags );

        do {
          if( StringTools::IsolateWord( flags, buffer, j++ )[0] != '\0' )
            exec_args[ a1++ ] = strdup( buffer );

          if( a1 > 126 ) {
            cerr << "  ERROR:  More than 127 arguments being paseed to executable; aborting" << endl;
            exec_args[ a1-1 ] = '\0';
            for( i = 0; exec_args[i] != NULL; i++ )
              free( exec_args[i] );
            return;
          }
        } while( buffer[0] != '\0' );
      }

      if( use_scene )
        exec_args[ a1++ ] = strdup( scene );

      exec_args[ a1++ ] = NULL;          // NULL-terminate the array

      // Display the argument string
      cout << "  Argument String For Executable:  " << endl;
      cout << "  ";
      for( unsigned int i = 0; exec_args[i] != NULL; i++ )
        cout << " " << exec_args[i];
      cout << endl;

      // Run the program asynchronously
      _spawnv( _P_NOWAIT, executable, exec_args );

      // Free the argument list
      for( i = 0; exec_args[i] != NULL; i++ )
        free( exec_args[i] );
    }

    cout << "-Complete!" << endl;
  }
}
示例#11
0
void BattleRoomTab::SetBattle( Battle* battle )
{
	m_battle = battle;

	m_team_sel->Enable(m_battle);
	m_ally_sel->Enable(m_battle);
	m_color_sel->Enable(m_battle);
	m_side_sel->Enable(m_battle);
	m_options_preset_sel->Enable(m_battle);

	m_minimap->Enable(m_battle);

	m_player_panel->Enable(m_battle);

	m_map_combo->Enable(m_battle);

	m_players->Enable(m_battle);

	m_leave_btn->Enable(m_battle);
	m_start_btn->Enable(m_battle);
	m_addbot_btn->Enable(m_battle);
	m_manage_players_btn->Enable(m_battle);
	m_save_btn->Enable(m_battle);
	m_delete_btn->Enable(m_battle);
	m_default_btn->Enable(m_battle);
	m_browse_map_btn->Enable(m_battle);

	m_ready_chk->Enable(m_battle);
	m_spec_chk->Enable(m_battle);
	m_lock_chk->Enable(m_battle);
	m_autolock_chk->Enable(m_battle);

	m_opts_list->Enable(m_battle);

	m_minimap->SetBattle( m_battle );
	m_players->SetBattle( m_battle );
	m_chat->SetBattle( m_battle );
	m_players->Clear();
	m_side_sel->Clear();

	if ( m_battle )
	{
		m_options_preset_sel->SetStringSelection( sett().GetModDefaultPresetName( m_battle->GetHostModName() ) );

		m_color_sel->SetColor( m_battle->GetMe().BattleStatus().colour );
		try
		{
			wxArrayString sides = usync().GetSides( m_battle->GetHostModName() );
			for ( unsigned int i = 0; i < sides.GetCount(); i++ )
			{
				m_side_sel->Append( sides[i], icons().GetBitmap( icons().GetSideIcon( m_battle->GetHostModName(), i ) ) );
			}
		}
		catch ( ... ) {}
		for ( UserList::user_map_t::size_type i = 0; i < m_battle->GetNumUsers(); i++ )
		{
			m_players->AddUser( m_battle->GetUser( i ) );
			#ifdef __WXMAC__
			UpdateUser( m_battle->GetUser( i ) );
			#endif
		}

		if ( !m_battle->IsFounderMe() )
		{
			m_options_preset_sel->Disable();
			m_save_btn->Disable();
			m_delete_btn->Disable();
			m_default_btn->Disable();
			m_manage_players_btn->Disable();
			m_lock_chk->Disable();
			m_autolock_chk->Disable();
		}

		m_host_new_btn->Show( false );

		RegenerateOptionsList();

		ReloadMaplist();

		UpdateBattleInfo( wxString::Format( _T( "%d_mapname" ), OptionsWrapper::PrivateOptions ) );
		UpdateBattleInfo();
		UpdateStatsLabels();
	}
	else
	{
		m_host_new_btn->Show( true );
	}
}
示例#12
0
void LogoutUser(MYSQL *conn, int id)
{
    UpdateUser(conn, id, NULL, NULL, NULL, FALSE);
}
示例#13
0
LRESULT CUserListCtrl::OnP4EndSpecEdit( WPARAM wParam, LPARAM lParam )
{
	CCmd_EditSpec *pCmd= (CCmd_EditSpec *) wParam;
	int i, j;

	if (lParam != IDCANCEL && lParam != IDABORT)
	{
		if (m_UpdateState == LIST_UPDATED)
		{
			// we have to set 'index' again in case user's name got changed
			int index = FindInList(m_pNewSpec->GetUserName());
			if(index > -1 )
				UpdateUser(m_pNewSpec, index);
			else
			{
				InsertUser(m_pNewSpec, GetItemCount());
				ReSort();

				if( m_Active != m_olduser )
				{
					if (GET_P4REGPTR()->GetExpandFlag() == 1)
						GET_P4REGPTR()->AddMRUPcuPath(MainFrame()->GetCurrentItemPath());
					m_Active = m_olduser;
					GET_P4REGPTR()->SetP4User( m_olduser, TRUE, FALSE, FALSE );
					MainFrame()->UpdateCaption( ) ;	
				}
			}
		}
		else
			if ( m_pNewSpec ) delete m_pNewSpec;

	    CString specOut(pCmd->GetSpecOut());
		if ((i = specOut.Find(_T("\n\nJobView:\t"))) != -1)
		{
			i += lstrlen(_T("\n\nJobView:\n"));
			if ((j = specOut.Find(_T('\n'),i)) != -1)
			{
				// if JobView has changed, we have to refresh the changelists (and depot)
				if (m_oldJobView != specOut.Mid(i, j-i))
					MainFrame()->UpdateDepotandChangeViews(TRUE);
			}
		}
	}
	else
		if ( m_pNewSpec ) delete m_pNewSpec;

	if (lParam != IDABORT)
	{
		MainFrame()->ClearStatus();
		if (pCmd->HaveServerLock())
			pCmd->ReleaseServerLock();
		CDialog *dlg = (CDialog *)pCmd->GetSpecSheet();
		dlg->DestroyWindow();
	}

	if ((lParam == IDCANCEL) && pCmd->GetIsNewUser())	// if canceled, cleanup newly created user
	{
		m_Active = pCmd->GetItemName();
		CString msg;
		msg.FormatMessage ( IDS_DELETENEWUSER_s, m_Active );
		// ask if they want to delete the newly created user
		if( AfxMessageBox( msg, MB_YESNO|MB_ICONQUESTION ) == IDYES)
		{
			// fire off the delete of the newly created user
			CCmd_Delete *pCmdDel = new CCmd_Delete;
			pCmdDel->Init( m_hWnd, RUN_ASYNC );
			pCmdDel->SetSwitch2User( m_olduser );
			if( pCmdDel->Run( P4USER_DEL, m_Active ) )
				MainFrame()->UpdateStatus( LoadStringResource(IDS_DELETING) );
			else
				delete pCmdDel;
		}
		else
		{
			OnViewUpdate();
		}
	}

	delete pCmd;
	m_EditInProgress = FALSE;
	return 0;
}