Since we have a new event "UserAuthorizationRequestReceived(User pUser)" with skype4com 1.0.29, adding a user to userlist would also be fine for my project.
From Api doku I know only a few user settings are writable
CODE
pUser.BuddyStatus = TBuddyStatus.budPendingAuthorization;
will add the requesting user to my userlist.
But this command will NOT authorize the requesting user.
So I send a new api command (because the skype4com command: pUser.IsAuthorized = true seems not to work)
CODE
cmd.Command = "SET USER " + pUser.Handle + " ISAUTHORIZED TRUE";
Now, whats the problem:
When using this two commands at "same time" it would add the user but not authorize the user and sometimes in the other way
Another Problem I found is that the event is fired two times each request!
This is a short demo: (sk is instance of Skype)
CODE
private void sk_UserAuthorizationRequestReceived(User pUser)
{
try
{
pUser.BuddyStatus = TBuddyStatus.budPendingAuthorization;
//pUser.IsAuthorized = true;
cmd = new Command();
cmd.Id = 323448;
cmd.Expected = pUser.Handle;
cmd.Blocking = false;
cmd.Command = "SET USER " + pUser.Handle + " ISAUTHORIZED TRUE";
//cmd.Command = "SET USER " + pUser.Handle + " BUDDYSTATUS 2";
sk.SendCommand(cmd);
sk.SendMessage(pUser.Handle, ".\n" + "TEST MESSAGE");
}
catch (Exception e)
{
}
}
Short:
Adding + authorize User at same time seems not to work
The message "TEST MESSAGE" is received/sent 2 times
Any Advice?
Thx a lot
I am confused as what you are really doing here trying to push two command texts in one command?
Example:
cmd.Command = "SET USER " + pUser.Handle + " ISAUTHORIZED TRUE";
cmd.Command = cmd.Command + "SET USER " + pUser.Handle + " BUDDYSTATUS 2";
sk.SendCommand(cmd);
That will never work. Also, if you are sending these one at a time are you waiting for a REPLY? before sending the other?
There are Hardcoded Groups and grpUsersWaitingMyAuthorization is one of these Hardcoded groups until the user is authorized. So you can access the User collection for that Hardcoded Group, and simply set BuddyStatus to 2 using Skype4COM Lib for a specific user found in that group.
I have an Example showing these groups in an example program, But....it only shows Onine users in the groups ("Because the program is for call transfer, and you can't transfer a call to a user who is offline"), but it would give you an Idea of what I mean. I provide full source code to the project as well at the bottom of the page:
http://share.skype.com/sites/devzone/2007/...nsfer.html#moreOr Click the Picture
Or Click the Picture
So Once you received the notification ("Using Skype4COM") via UserAuthorizationRequestReceived(User pUser)"
1. Loop thru all your groups, find the grpUsersWaitingMyAuthorization Hardwired Group.
2. Loop thru the User Collection of the grpUsersWaitingMyAuthorization Group looking for (User pUser) returned from UserAuthorizationRequestReceived.
3. Set that user.BuddyStatus = TBuddyStatus.budPendingAuthorization.
There is also a Groups.vbs example included in the .chm help file with 1.0.29.0 .Zip for Skype4COM that shows the HardWired Groups as well.
From the Skype4COM.idl included in the .chm help documentation for .1.0.29.0
CODE
typedef enum TGroupType
00406 {
00407 [helpcontext(17),helpstring(hsGroupType_Unknown)] grpUnknown = -1,
00408 [helpcontext(17),helpstring(hsGroupType_Custom)] grpCustomGroup = 0,
00409 [helpcontext(17),helpstring(hsGroupType_AllUsers)] grpAllUsers = 1,
00410 [helpcontext(17),helpstring(hsGroupType_AllFriends)] grpAllFriends = 2,
00411 [helpcontext(17),helpstring(hsGroupType_SkypeFriends)] grpSkypeFriends = 3,
00412 [helpcontext(17),helpstring(hsGroupType_SkypeOutFriends)] grpSkypeOutFriends = 4,
00413 [helpcontext(17),helpstring(hsGroupType_OnlineFriends)] grpOnlineFriends = 5,
00414 [helpcontext(17),helpstring(hsGroupType_PendingAuthFriends)] grpPendingAuthorizationFriends = 6,
00415 [helpcontext(17),helpstring(hsGroupType_RecentContactUsers)] grpRecentlyContactedUsers = 7,
[b]
00416 [helpcontext(17),helpstring(hsGroupType_WaitMyAuthorization)] grpUsersWaitingMyAuthorization = 8,
[b]
00417 [helpcontext(17),helpstring(hsGroupType_AuthorizedByMe)] grpUsersAuthorizedByMe = 9,
00418 [helpcontext(17),helpstring(hsGroupType_BlockedByMe)] grpUsersBlockedByMe = 10,
00419 [helpcontext(17),helpstring(hsGroupType_UngroupedFriends)] grpUngroupedFriends = 11,
00420 [helpcontext(17),helpstring(hsGroupType_SharedGroup)] grpSharedGroup = 12,
00421 [helpcontext(17),helpstring(hsGroupType_ProposedSharedGroup)] grpProposedSharedGroup = 13
00422 } TGroupType;
NOTE: The grpPendingAuthorizationFriends hardwired group is the names of Skype Users that have NOT approved YOU yet ;-)