Skype invitation message
Asked Answered
H

2

9

I want to invite a user sending a specific message, but I can't find where I can set invitation message.

This is a (simplified) sample of what I do:

skype.Client.Start(true, true);
var user = skype.SearchForUsers("the_name_i_am_searching_for")
    .Cast<User>()
    .FirstOrDefault();
if (user != null)
    user.BuddyStatus = TBuddyStatus.budPendingAuthorization;

With this code default invitation is sent.

Hartung answered 9/2, 2014 at 1:26 Comment(2)
Visit https://mcmap.net/q/1316345/-skype-how-to-get-started and find it in the code.Strontium
@YoelMacia: what should I take from that post? I know how to send messages to users and how to ask someone to be a skype friend; what I don't know is how modify the invitation message automatically sent then you do user.BuddyStatus = TBuddyStatus.budPendingAuthorization!Hartung
D
9

Try to use Property array instead of a simple assignment. Change

user.BuddyStatus = TBuddyStatus.budPendingAuthorization;

to

skype.Property["USER", "the_name_i_am_searching_for", "BUDDYSTATUS"] = 
    string.Format("{0} {1}", (int)TBuddyStatus.budPendingAuthorization, 
                             "your welcome message")

I failed to find any official docs, but this lib was very helpful. Notice SetBuddyStatusPendingAuthorization method

Demp answered 18/2, 2014 at 18:35 Comment(3)
Thanks a lot Grin! Your sample was perfect!Hartung
Just a note: VS tells you is better using skype.Property["USER", "the_name_i_am_searching_for", "BUDDYSTATUS"] = string.Format("{0} {1}", (int)TBuddyStatus.budPendingAuthorization, "your welcome message")Hartung
@Hartung I had to install R# to get this suggestion. Thanks for a note!Demp
L
1

The skype API offers a function skype.SendMessage(<username>, <string>) which I think is what you are looking for.

Literature answered 18/2, 2014 at 13:43 Comment(1)
No, SendMessage is used to send a message to a user. Unfortunately it's not the message you send when you invite a user to become your friend...Hartung

© 2022 - 2024 — McMap. All rights reserved.