public GetUser ( int portalId, int userId, int currentUserId ) : |
||
portalId | int | |
userId | int | |
currentUserId | int | |
return |
private XmlRpcStruct GetUser(string username, int userId) { var aftContext = ActiveForumsTapatalkModuleContext.Create(Context); if (aftContext == null || aftContext.Module == null) throw new XmlRpcFaultException(100, "Invalid Context"); Context.Response.AddHeader("Mobiquo_is_login", aftContext.UserId > 0 ? "true" : "false"); // Not fully implemented... Disable for now. // for our purposes, we ignore the username and require userId // If we don't have a userid, pass back a anonymous user object if (true || userId <= 0) { return new XmlRpcStruct { { "user_id", userId.ToString() }, { "user_name", username.ToBytes() }, { "post_count", 1 } }; } var portalId = aftContext.Module.PortalID; var currentUserId = aftContext.UserId; var fc = new AFTForumController(); var user = fc.GetUser(portalId, userId, currentUserId); const bool allowPM = false; //TODO : Tie in with PM's const bool acceptFollow = false; if (user == null) { return new XmlRpcStruct { { "user_id", userId.ToString() }, { "user_name", username.ToBytes() }, { "post_count", 1 } }; } var forumModuleId = aftContext.ModuleSettings.ForumModuleId; var mainSettings = new SettingsInfo { MainSettings = new Entities.Modules.ModuleController().GetModuleSettings(forumModuleId) }; return new XmlRpcStruct { { "user_id", userId.ToString() }, { "user_name", GetUserName(mainSettings, user).ToBytes() }, { "post_count", user.PostCount }, { "reg_time", user.DateCreated }, { "last_activity_date", user.DateLastActivity }, { "is_online", user.IsUserOnline }, { "accept_pm", allowPM }, { "i_follow_u", user.Following }, { "u_follow_me", user.IsFollower }, { "accept_follow", acceptFollow }, { "following_count", user.FollowingCount }, { "follower", user.FollowerCount }, { "display_text", user.UserCaption.ToBytes() }, { "icon_url", GetAvatarUrl(userId) }, }; }