| 1 |
namespace Xmpp.Xep.ServiceDiscovery { |
| 2 |
|
| 3 |
public class Identity { |
| 4 |
public const string CATEGORY_CLIENT = "client"; |
| 5 |
public const string CATEGORY_CONFERENCE = "conference"; |
| 6 |
|
| 7 |
public const string TYPE_PC = "pc"; |
| 8 |
public const string TYPE_PHONE = "phone"; |
| 9 |
public const string TYPE_TABLET = "tablet"; |
| 10 |
|
| 11 |
public string category { get; set; } |
| 12 |
public string type_ { get; set; } |
| 13 |
public string? name { get; set; } |
| 14 |
|
| 15 |
public Identity(string category, string type, string? name = null) { |
| 16 |
this.category = category; |
| 17 |
this.type_ = type; |
| 18 |
this.name = name; |
| 19 |
} |
| 20 |
|
| 21 |
public static uint hash_func(Identity a) { |
| 22 |
uint hash = a.category.hash() ^ a.type_.hash(); |
| 23 |
if (a.name != null) { |
| 24 |
hash ^= a.name.hash(); |
| 25 |
} |
| 26 |
return hash; |
| 27 |
} |
| 28 |
|
| 29 |
public static bool equals_func(Identity a, Identity b) { |
| 30 |
return a.category == b.category && a.type_ == b.type_ && a.name == b.name; |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
} |