本文整理汇总了C#中Contact.getReceivedAuthRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.getReceivedAuthRequest方法的具体用法?C# Contact.getReceivedAuthRequest怎么用?C# Contact.getReceivedAuthRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact.getReceivedAuthRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onChange
/**
* ContactGroupListener Override: Tutorial Handler - ContactGroup TYPE.
* <br /><br />
* This handler fires for all ContactGroups. If it's <em>not</em>
* a pending authorization request, log and ignore it.
* <br /><br />
* Tutorial 9 - Process authorization requests
*
* @since 1.0
*
* @see com.skype.api.ContactGroupListener#onChange(com.skype.api.ContactGroup, com.skype.api.Contact)
*/
public void onChange(com.skype.api.ContactGroup obj, Contact contact)
{
if (contact != null)
{
String contactSkypeName = contact.getSkypeName(); // Find out who it's from
String contactDisplayName = contact.getDisplayName();
ContactGroup waitingAuth =
mySession.mySkype.getHardwiredContactGroup(ContactGroup.Type.CONTACTS_WAITING_MY_AUTHORIZATION);
Contact[] waitingAuthMembers = waitingAuth.getContacts();
int waitingAuthMembersCnt = waitingAuthMembers.Length;
if (waitingAuthMembersCnt == 0)
{
MySession.myConsole.printf("%s: Ignoring ContactGroup change for %s (%s); no Contacts awaiting authorization %n",
mySession.myTutorialTag, contactSkypeName, contactDisplayName);
return;
}
if (contact.getReceivedAuthRequest().Length == 0)
{
MySession.myConsole.printf("%s: Ignoring ContactGroup change; Contact %s (%s) is not awaiting authorization %n",
mySession.myTutorialTag, contactSkypeName, contactDisplayName);
return;
}
String authRequestText = contact.getReceivedAuthRequest(); // Get any intro text...
if ((authRequestText == null) || (authRequestText.Length == 0))
{ // ...and default it if missing
authRequestText = "-- NO INTRODUCTORY TEXT --";
}
MySession.myConsole.printf("%s: Authorization request from: %s (%s):%n\t%s",
mySession.myTutorialTag, contactSkypeName, contactDisplayName, authRequestText);
contact.setBuddyStatus(true, true);
/*
* SetBuddyStatus should really return a boolean...
* If and when it does, replace the above SetBuddyStatus invocation with the following...
if (contact.setBuddyStatus(true, true)) {
MySession.myConsole.printf("%s: %s is now authorized%n", mySession.myTutorialTag, contactSkypeName);
}
else {
MySession.myConsole.printf("%s: Authorization failed.%n", mySession.myTutorialTag);
}
*/
MySession.myConsole.printf("%s: %s is now authorized!%n", mySession.myTutorialTag, contactSkypeName);
}
}