Esempio n. 1
0
        /// <summary>
        /// Sets a users in game dustforce name.
        /// </summary>
        /// <param name="ircuser">The ircuser whose name to set.</param>
        /// <param name="dustforcename">The users dustforce name.</param>
        public bool SetIgnByIrc(string ircuser, string dustforcename)
        {
            User user = this[ircuser];
            IGN ign = GetIgnByDustforcename(dustforcename);
            if (ign != null) {
                User ignUser = GetUserByIGN(ign.DustforceName);
                //if (!|| (dustforcelist[dustforceuser].ircname.ToLower() == ircLower)) {
                if (ignUser != null && ignUser.Id != user.Id) {
                    FB.Notice(ircuser, "That IGN is already registered to someone else. Perhaps you registered it under another IRC nickname? If this is an issue, ask an admin to use .deleteign on that IGN.");
                    return false;
                } else { //ignUser was null, or it matches the expected userId. So update.
                    string oldname = ign.DustforceName;

                    ign.DustforceName = dustforcename;

                    SaveIgn(ign);
                    return true;
                }
            } else {
                ign = new IGN();
                ign.DustforceName = dustforcename;
                ign.IrcUserId = user.Id;
                SaveIgn(ign);
                return true;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Saves the ign to the Igns table.
 /// </summary>
 /// <param name="user">The ign.</param>
 public void SaveIgn(IGN ign)
 {
     var result = Igns.Save(ign);
 }