Hi,
Iam developing gtalk application. In this process, Itried to
implement signing into server using the following code. I have no clue
where i am going wrong. I am unable to receive the notifications from
"DoLogin" method of xmpppump. kindly help me in this issue.
************************************************************
class login_notifier: public sigslot::has_slots<>
{
public:
login_notifier(){}
void OnStateChange(buzz::XmppEngine::State state);
};
void login_notifier::OnStateChange(buzz::XmppEngine::State state)
{
std::cout << "in onstatechange meathod\n";
switch (state)
{
case buzz::XmppEngine::STATE_START:
// Attempting sign in.
std::cout<<"Attempting sign in\n";
break;
case buzz::XmppEngine::STATE_OPENING:
// Negotiating with server.
std::cout<<" Negotiating with server\n";
break;
case buzz::XmppEngine::STATE_OPEN:
// Connection succeeded. Send your presence
information.
// and sign up to receive presence notifications.
std::cout<<"Connection succeeded\n";
break;
case buzz::XmppEngine::STATE_CLOSED:
// Connection ended.
std::cout<<"Connection ended\n";
break;
default:
std::cout<<"something happened :P\n";
}
}
int main()
{
//1. initializing SSL
talk_base::InitializeSSL();
//2. creating the signalling thread
talk_base::PhysicalSocketServer ss;
talk_base::AutoThread main_thread(&ss);
//3. Get login information from the user
buzz::Jid jid;
buzz::XmppClientSettings xcs;
talk_base::InsecureCryptStringImpl pass;
std::string username;
// Read and verify the user's JID from the command-line.
// std::cout << "JID: ";
username="[EMAIL PROTECTED]";
// verifing username
jid = buzz::Jid(username);
if (!jid.IsValid() || jid.node() == "")
{
printf("Invalid JID. JIDs should be in the form
[EMAIL PROTECTED]");
return 1;
}
// Read the user's password (invisibly) from the screen
// char pwd[15]="\0";
// SetConsoleEcho(false);
// std::cout << "Password: "<< pwd;
pass.password() = "password";
// SetConsoleEcho(true);
std::cout << std::endl;
//setting our current proxy settings
xcs.set_protocol(cricket::PROTO_SSLTCP);
xcs.set_proxy(talk_base::PROXY_HTTPS);
xcs.set_proxy_host("10.100.56.45");
xcs.set_proxy_port(3128);
xcs.set_use_proxy_auth(false);
//setting server dependent variables
xcs.set_user(jid.node());
xcs.set_resource("pcp");
xcs.set_host(jid.domain());
xcs.set_use_tls(true);
xcs.set_pass(talk_base::CryptString(pass));
xcs.set_server(talk_base::SocketAddress("talk.google.com",
443));
//4. Create your XMPP task manager object
XmppPump pump;
login_notifier notifier;
std::cout << "before calling meathod\n";
pump.client()->SignalStateChange.connect(¬ifier,
&login_notifier::OnStateChange);
std::cout << "before dologin meathod\n";
//5. Connect to receive sign in progress notifications
// Queue up the sign in request.
pump.DoLogin(xcs, new XmppSocket(true), 0);
std::cout<<"logged in";
// Start the thread and run indefinitely.
main_thread.Run();
return 0;
}
************************************************************
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-talk-open" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-talk-open?hl=en
-~----------~----~----~----~------~----~------~--~---