How to Create a libjingle Program

Source: Internet
Author: User

Reading this document is a bit confusing. It is better to look at the code of the login example in the source code talk.

STD: cout <"auth COOKIE :";
STD: String auth_cookie;
STD: Getline (STD: Cin, auth_cookie );

STD: cout <"User name :";
STD: String username;
STD: Getline (STD: Cin, username );

// Start XMPP on a different thread
Xmppthread thread;
Thread. Start ();

Buzz: xmppclientsettings XCS;
XCS. set_user (username. c_str ());
XCS. set_host ("gmail.com ");
XCS. set_use_tls (Buzz: tls_disabled );
XCS. set_auth_cookie (auth_cookie.c_str ());
XCS. set_server (talk_base: socketaddress ("talk.google.com", 5222 ));
Thread. login (XCS );

// Use main thread for console input
STD: String line;
While (STD: Getline (STD: Cin, line )){
If (line = "quit ")
Break;
}
Return 0;

The focus is on the content of the xmppclientsettings and xmppthread2.

View the definition of xmppclientsettings, which is a subclass of xmppusersettings. The two classes seem to be used only as Data encapsulation. There are only attributes and no substantive actions.

I don't know what is the difference between set_host and set_server. Is host and server not the same thing?

Xmppthread is an implementation inherited from talk_base: thread, xmpppumpnotify, talk_base: messagehandler.

A post method is called in login. I don't know where the POST method comes from. post only submits a message. Maybe it is the built-in system. The specific login process is written in onmessage.

An xmpppump class is generated when xmppthread is created. Call the xmpppump dologin method to complete XMPP-based logon.

Then there is a cycle for receiving messages. CPU usage by loops. So this is just a login example.

What is hateful is that this example does not prompt whether the logon is successful... Great tragedy

I guess the prompt for successful update should be written in the onstatechange event. This is not implemented in the example.

Write code to output the state variable. However, no matter whether my account and password are correct, the status is only 124, not 3. It seems that status 3 is successful.

Enum state {
State_none = 0 ,//! <Nonexistent state
State_start ,//! <Initial state.
State_opening ,//! <Exchanging stream headers, authenticating and so on.
State_open ,//! <Authenticated and bound.
State_closed ,//! <Session closed, possibly due to error.
};

SSL may be required, possibly... Okay. First.

Let's look at the call example. I tried this example to log on.

In addition, I admit that this example is very powerful.

I have read it today, and 0.6.13 has come out.

I want to make the example call into a vs project.

Compile more than 600 errors

Add the property settings defined in the Win32 environment, C/C ++, preprocess, and preprocess definitions.

In addition, the testing part of the code is missing. You can remove related files first .. There should be code, and the path is incorrect. It seems that hammer. bat can generate the corresponding lib library.

There is an undeclared error in STR, because feature_enable_voicemail is not added.

For details, refer to the Conditional compilation code in constrans. h.

Then there are many Link errors, with more than 300. Based on experience, this is certainly a problem with incorrect lib settings.

After the Lib path is added, the corresponding reference is added to the linker. A lot less.

There is also a conflict with msvcprtd. Lib. In configuration properties-> linker-> ignore specific library, Set

2012-2-21

The error persists. According to the error Google, 103 error is left after winmm. Lib is added.

26 errors left when ws2_32.lib is added

Add crypt32.lib secur32.lib dnsapi. Lib with 10 errors left

There are only nine requests to add iphlpapi. Lib. It's really depressing. Is there any better way to check these lib missing. Google required?

I suddenly thought of viewing the scons file. Seven strmiids. Lib added

Based on the clues of the scons file. Found to be compiled in/MT Mode

Then remove the Lib of the previous ignore specific library. OK ..

I admire myself, not just Google's little white. After half a day, you may only need to set it to Mt mode, and then add the required lib to install scons. Try again in another day.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.