Public Class QQ_Friend_Categorie
    Public Friends As IDictionary(Of String, String) = New Dictionary(Of String, String)()
    Public Name As String
    Public Index As String
    Public Sort As String
End Class

Public Class QQ_Friend_List
    Public Catagories As New List(Of QQ_Friend_Categorie)
    Public _str As String
    Public Function Get_Name_From_Id(Id As String) As String
        For Each i As QQ_Friend_Categorie In Catagories.ToArray
            If i.Friends.ContainsKey(Id) Then
                Return i.Friends(Id)
                Exit For
            End If
        Next
        Return ""
    End Function

    Public Function Get_All_Friends() As IDictionary(Of String, String)
        Dim r As New Dictionary(Of String, String)()
        For Each i As QQ_Friend_Categorie In Catagories.ToArray
            For Each j As String In i.Friends.Keys
                r.Add(j, i.Friends(j))
            Next
        Next
        Return r
    End Function

    Public Function Get_Uid_List() As String()
        Dim r As New List(Of String)
        For Each i As QQ_Friend_Categorie In Catagories.ToArray
            For Each j As String In i.Friends.Keys
                r.Add(j)
            Next
        Next
        Return r.ToArray
    End Function
End Class

Public Class QQ_Group_List
    Dim QQ_Groups As QQ_Group()
    Public ReadOnly Property Items As QQ_Group()
        Get
            Return QQ_Groups
        End Get
    End Property

    Public ReadOnly Property Item(ByVal Gid As String) As QQ_Group
        Get
            For Each g As QQ_Group In QQ_Groups
                If g.Gid = Gid Then Return g
            Next
            Return Nothing
        End Get
    End Property

    Public Sub New(_QQ_Groups As QQ_Group())
        QQ_Groups = _QQ_Groups
    End Sub
End Class

Public Class QQ_Group
    Public Name As String
    Public Gid As String
    Public GCode As String
    Public Sub New(_Name As String, _Gid As String, _GCode As String)
        Name = _Name
        Gid = _Gid
        GCode = _GCode
    End Sub
End Class

Public Class QQ_Message
    Public From_Group As Boolean
    Public msg_id, from_uin, to_uin, msg_id2, msg_type, reply_ip, time As String
    Public group_code, send_uin, seq, info_seq As String
    Public Contents As New List(Of QQ_Message_Content)
    Public Font As New QQ_Font

    Public Function GetString() As String
        Dim r As String = ""
        For Each c As QQ_Message_Content In Contents.ToArray
            If c.Type = Content_Type.Text Then r += c.Value
        Next
        Return r
    End Function
End Class

Public Structure QQ_Font
    Public Name, Size, Color As String
    Public Style As Newtonsoft.Json.Linq.JArray
End Structure

Public Structure QQ_Message_Content
    Public Type As Content_Type
    Public Value As String
    Public Sub New(ByVal _Value As String, Optional ByVal _Type As Content_Type = Content_Type.Text)
        Value = _Value
        Type = _Type
    End Sub
End Structure

Public Enum Content_Type
    Text
    Face
    Picture
    Unknown
End Enum

Public Class QQ_Message_Sender
    Public Target As String
    Public IsGroup As Boolean
    Public Client As WebQQ_Client
    Public Sub New(_Client As WebQQ_Client, _Target As String, _IsGroup As Boolean)
        Target = _Target
        IsGroup = _IsGroup
        Client = _Client
    End Sub
    Public Sub New(Message As QQ_Message)
        Target = Message.from_uin
        IsGroup = Message.From_Group
    End Sub
    Public Sub Send(Message As String)
        Client.Send_Text_Message(Target, Message, IsGroup, 300000 + Rnd() * 500000)
    End Sub
End Class