How to send an IM in C or C++ on Windows - c++

Specifically I am talking about using AIM and sending instant messages to an existing AIM screename. How would I accomplish this? I am trying to do it the simplest way possible -efficiency is not that important.
I thought maybe all I would have to do is open a socket connections some how but I am probably wrong.

I would use libpurple. It's a multi-platform C library that supports many IM services, including AIM.

Check out the source for GAIM/Pidgin, which runs on a variety of platforms including windows. It uses a modified version of libfaim.

Related

signal/Textsecure bindings for c/c++?

I am trying to create a signal/textsecure client using qt and C++, however i cant seem to fibd any C++ bindings for it.
the only bindings i can find are for Go (https://github.com/nanu-c/textsecure/)
is there any way to connect C++ with signal?
edit:
i wanted to clarify some things:
-im talking about the messaging app called Signal (https://signal.org)
-i am trying to write an app for ubuntu touch and am developing on manjaro linux.
On Linux or Unix, you probably want to communicate with other remote applications using some communication protocol, such as HTTP or HTTPS or SOAP or JSONRPC or ONCRPC. Of course read about socket(7) and before that Advanced Linux Programming then about syscalls(2). Consider reading a textbook on Operating Systems
Be sure to study the source code related to Signal. Read their technical documentation.
You surely need to understand the details. So take a few days or weeks to read more about them.
If you want to use some web service, you need to read and understand its documentation and when and how you are allowed to use it. There could be legal or financial issues.
Then you might use HTTP related libraries (e.g. Wt or libonion server side, and libcurl or curlpp client side).
See also in April 2020 the ongoing HelpCovid free software project (for Linux), at least for inspiration. We are coding it in C++.
after a little more digging i found that textsecure bindings are now renamed to libsignal.
after finding that out i found a lib for c/c++
https://github.com/signalapp/libsignal-protocol-c

Creating an SNMP agent with Qt and C++

I'm considering adding SNMP support to a simple daemon I wrote under linux. My daemon is written in C++ and Qt5.
I'm looking for an easy way to add this support. I found several MIB creation tools, the problem is writing the agent (or subagent). I'd rather not code this in C, would anyone know of q Qt library that helps out? I found mib2c which will create a skeleton in C (but I'd rather use C++ with Qt).
You can try using CIMPLE, which I've forked on github from it's original website. I've done some cleanup on github and I've attempted to contact the original authors, but they've never returned any of my emails which makes me wonder whether or not they intend to continue supporting the library.
Regardless, it does work and it plays fairly nicely with both Windows and Linux, which have very different styles of implementing SNMP agents. If you google around for "WBEM" you will find some other libraries as well. CIMPLE is the one we used at Fusion-io for SNMP support. It supported C++ fairly well and uses a code generator to handle lots of the boiler plate stuff that's really boring to write and not specific to your application.

Detecting new device insert in C++

I've tried to find a way to detect when a new device (like a USB) is inserted into a computer, but everything I've seen required MFC, which I don't have. Is there a way to do this without MFC? If not, I understand, but I haven't seen anything of the like in my Google searches.
Thanks,
C++ by itself does not have any platform-dependent hardware-level functionality. You will need to use some API, like Win32 or MFC or .NET on Windows.
You can do this using libusb and there's a port of libusb for win32, so you might have some luck using that instead of MFC, with the added bonus of being more portable.
Handle the WM_DEVICECHANGE message.
See http://msdn.microsoft.com/en-us/library/aa363480(v=vs.85).aspx
EDIT: Of course, this is Windows only, which the OP didn't specify. There's no way to do this without external libraries or platform specific APIs.

port native C++ non static binary on Android

Im quite new on Android and I have some question for all of you who are experts!
Ok, my problem...
I implemented a client-server application based on socket programming. The server encode some packets, send them to the client through a socket and the clinet decode them.
I tested the code with two linux machines and it works fine but in my experiment it is required to include another node (this will be the Android). So the server (linux machine) will encode the packets and send through socket to client1(linux machine) and client2(Android).
For this reason I want to port the native binary of my code (which is in C++) to Android.
In which way could I do this?
Please give me some help!
Really im totally stucked!
Thanks,
Zenia
when you want to port native code C/C++ to android you want to look up android ndk and jni
http://developer.android.com/sdk/ndk/index.html
http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html
There are some examples in the ndk on how to do this.
be warned that C is fully supported but C++ support apis is very limited on android (the list is in the docs of the ndk) so you might have problems porting your code.
I would recommend using directly java if you can, since working with JNI is tedious lol
how else can you port this? start learning android i did a quick check noticed it's sdk uses java you can start by looking at
http://developer.android.com/reference/java/net/Socket.html
Thanks for the reply,
I first tried to write my own code totally in java using sockets, however i had to port some optimized libraries to Android and I could figure out how to do that (i could port a simple small library but not the one that I wanted). I gave up and I right now im trying to play with jni and ndk. however i dont know if indeed i could port my binary as it is non static (like hello world). Thats why im asking. if anyone else have some experince on that please let me know. thanks a lot,
Zenia
What you should probably do is install the SDK and NDK and build the hello-jni ndk example.
Then look up how to access the android logcat output from C, and write yourself a nice little printf-like wrapper for that (probably using the vargs version of the underlying function) so you can easily generate debug output from your native code.
Then graft your native executable onto the hello-jni example code, so you'll have a java wrapper that does very little other than start things with a call to the native code. Just remember not to do much processing in the UI thread or native code called under that thread, or you will risk an application not responding timeout.
It is also possible to (ab)use the ndk's gcc to produce stand alone native executables with no java wrapper, but this is discouraged. It's hard to find a reliable place to install them on a non-rooted phone, and android's process management isn't happy about unknown native processes. In other words, that's a path that's fine for personal experiments on your own device, but a difficult and non-future-proof one for an application deployed to others.

What Linux IPC to use between a c program and a C++ Qt app?

I have a old school c program that now and then
need to tell a C++ Qt based application about some "events" that has occurred on my system.
But when I started to work with this problem I noticed that some ipc techniques is quite easy to use in the c program.
And then we have some Qt specific styles that works quite well in the "Qt world",
but they will not work well in the ansi c program.
Do you have any advice on ipc techniques that works well and are easy to use in both a Qt C++ and a c program?
Thanks
Johan
If you are familiar with network programming, Unix domain sockets should be easy also. They work kind of like bidirectional named pipes and the network API in Qt should make it easy to receive "events" delivered as network messages.
What about named pipes? You can operate on them just like on regular files (creation is a bit different of course), and I bet both old ANSI C programs and new Qt C++ programs can operate on files.
If the event notifications are very simple then you could use signals.
If the notification is useful from/to outside sources then D-Bus is an option.