C# Class Aura.Msgr.Database.MsgrDb

Exibir arquivo Open project: aura-project/aura

Public Methods

Method Description
AddGroup ( Aura.Msgr.Database.User user, Aura.Msgr.Database.Group group ) : void

Adds group to database.

AddNote ( string sender, string receiver, string message ) : void

Adds note to database.

Blacklist ( int userId, int contactId ) : void

Creates friend entry for contact on user with the blacklist status.

ChangeGroup ( Aura.Msgr.Database.User user, int friendContactId, int groupId ) : void

Changes group the friend is in in the database.

CountFriends ( int contactId ) : long

Returns the amount of friends the given contact has.

DeleteFriend ( int contactId1, int contactId2 ) : void

Deletes friend entries between the two users.

DeleteGroup ( Aura.Msgr.Database.User user, int groupId ) : void

Deletes group from database and moves friends in that group to ETC.

DeleteNote ( string receiver, long noteId ) : void

Deletes note from database.

GetFriendFromUser ( string characterName, string server ) : Aura.Msgr.Database.Friend

Returns friend for invitation, or null if the user doesn't exist.

GetFriends ( Aura.Msgr.Database.User user ) : List

Returns list of friends for user.

GetGroups ( Aura.Msgr.Database.User user ) : ICollection

Returns list of all groups in user's friend list.

GetLatestUnreadNote ( string receiver, long noteId ) : Note

Returns first note with an id higher than the given one, or null if none exist.

GetNote ( long noteId ) : Note

Returns note with given id, or null on error.

GetNotes ( Aura.Msgr.Database.User user ) : List

Returns all notes for user.

GetOrCreateContact ( string accountId, long characterEntityId, string characterName, string server, string channelName ) : Aura.Msgr.Database.User

Returns a user for the given values, either from the db, or by creating a new one.

GetUserByCharacterId ( long characterEntityId ) : Aura.Msgr.Database.User

Returns contact with the given character id from the database or null if it wasn't found.

InviteFriend ( int userId, int friendId ) : void

Creates friend entries for user and friend with status inviting/invited.

IsBlacklisted ( int userId, int contactId ) : bool

Returns true if user blacklisted contact.

RenameGroup ( Aura.Msgr.Database.User user, int groupId, string groupName ) : void

Renames group in database.

SaveOptions ( Aura.Msgr.Database.User user ) : void

Saves user's options to database.

SetFriendshipStatus ( int contactId1, int contactId2, FriendshipStatus status ) : void

Updates friendship status between the two users.

SetFriendshipStatusOneSided ( int contactId1, int contactId2, FriendshipStatus status ) : void

Updates friendship status for contact 1.

SetNoteRead ( long noteId ) : void

Sets read flag for given note.

Private Methods

Method Description
ReadNote ( MySqlDataReader reader ) : Note

Reads note from reader, returns null on error.

UpdateLastLogin ( Contact contact ) : void

Updates contact's last login time.

Method Details

AddGroup() public method

Adds group to database.
public AddGroup ( Aura.Msgr.Database.User user, Aura.Msgr.Database.Group group ) : void
user Aura.Msgr.Database.User
group Aura.Msgr.Database.Group
return void

AddNote() public method

Adds note to database.
public AddNote ( string sender, string receiver, string message ) : void
sender string
receiver string
message string
return void

Blacklist() public method

Creates friend entry for contact on user with the blacklist status.
public Blacklist ( int userId, int contactId ) : void
userId int
contactId int
return void

ChangeGroup() public method

Changes group the friend is in in the database.
public ChangeGroup ( Aura.Msgr.Database.User user, int friendContactId, int groupId ) : void
user Aura.Msgr.Database.User
friendContactId int
groupId int
return void

CountFriends() public method

Returns the amount of friends the given contact has.
public CountFriends ( int contactId ) : long
contactId int
return long

DeleteFriend() public method

Deletes friend entries between the two users.
public DeleteFriend ( int contactId1, int contactId2 ) : void
contactId1 int
contactId2 int
return void

DeleteGroup() public method

Deletes group from database and moves friends in that group to ETC.
public DeleteGroup ( Aura.Msgr.Database.User user, int groupId ) : void
user Aura.Msgr.Database.User
groupId int
return void

DeleteNote() public method

Deletes note from database.
public DeleteNote ( string receiver, long noteId ) : void
receiver string
noteId long
return void

GetFriendFromUser() public method

Returns friend for invitation, or null if the user doesn't exist.
public GetFriendFromUser ( string characterName, string server ) : Aura.Msgr.Database.Friend
characterName string
server string
return Aura.Msgr.Database.Friend

GetFriends() public method

Returns list of friends for user.
public GetFriends ( Aura.Msgr.Database.User user ) : List
user Aura.Msgr.Database.User
return List

GetGroups() public method

Returns list of all groups in user's friend list.
public GetGroups ( Aura.Msgr.Database.User user ) : ICollection
user Aura.Msgr.Database.User
return ICollection

GetLatestUnreadNote() public method

Returns first note with an id higher than the given one, or null if none exist.
public GetLatestUnreadNote ( string receiver, long noteId ) : Note
receiver string
noteId long
return Note

GetNote() public method

Returns note with given id, or null on error.
public GetNote ( long noteId ) : Note
noteId long
return Note

GetNotes() public method

Returns all notes for user.
public GetNotes ( Aura.Msgr.Database.User user ) : List
user Aura.Msgr.Database.User
return List

GetOrCreateContact() public method

Returns a user for the given values, either from the db, or by creating a new one.
public GetOrCreateContact ( string accountId, long characterEntityId, string characterName, string server, string channelName ) : Aura.Msgr.Database.User
accountId string
characterEntityId long
characterName string
server string
channelName string
return Aura.Msgr.Database.User

GetUserByCharacterId() public method

Returns contact with the given character id from the database or null if it wasn't found.
public GetUserByCharacterId ( long characterEntityId ) : Aura.Msgr.Database.User
characterEntityId long
return Aura.Msgr.Database.User

InviteFriend() public method

Creates friend entries for user and friend with status inviting/invited.
public InviteFriend ( int userId, int friendId ) : void
userId int
friendId int
return void

IsBlacklisted() public method

Returns true if user blacklisted contact.
public IsBlacklisted ( int userId, int contactId ) : bool
userId int
contactId int
return bool

RenameGroup() public method

Renames group in database.
public RenameGroup ( Aura.Msgr.Database.User user, int groupId, string groupName ) : void
user Aura.Msgr.Database.User
groupId int
groupName string
return void

SaveOptions() public method

Saves user's options to database.
public SaveOptions ( Aura.Msgr.Database.User user ) : void
user Aura.Msgr.Database.User
return void

SetFriendshipStatus() public method

Updates friendship status between the two users.
public SetFriendshipStatus ( int contactId1, int contactId2, FriendshipStatus status ) : void
contactId1 int
contactId2 int
status FriendshipStatus
return void

SetFriendshipStatusOneSided() public method

Updates friendship status for contact 1.
public SetFriendshipStatusOneSided ( int contactId1, int contactId2, FriendshipStatus status ) : void
contactId1 int
contactId2 int
status FriendshipStatus
return void

SetNoteRead() public method

Sets read flag for given note.
public SetNoteRead ( long noteId ) : void
noteId long
return void