Simple Telegram client that read new channel messages that I'm Subscribed? - c++

I need to read all new messages of one specific channel that I'm in (not as an admin but I,m Subscribed). I need to do this by C++. My OS is Ubuntu 20.04 Server.
I Install TDlib by the following Commands :
apt-get update
apt-get upgrade
apt-get install make git zlib1g-dev libssl-dev gperf php cmake g++
git clone https://github.com/tdlib/td.git
cd td
git checkout v1.6.0
rm -rf build
mkdir build
cd build
export CXXFLAGS=""
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
cmake --build . --target prepare_cross_compiling
cd ..
php SplitSource.php
cd build
cmake --build . --target install
cd ..
php SplitSource.php --undo
cd ..
ls -l /usr/local
can anybody give me a simple C++ example and command to compile that to run over console and get new incoming messages from specific channel? i need to be all login and API client info () be in the code. any help will be really appreciated.

Related

How i can Compile telegram cpp client given by telegram github?

I find telegram clients sample in c++ languages. first i install TDlib on Ubuntu 20.4 by the following commands :
apt-get update
apt-get upgrade
apt-get install make git zlib1g-dev libssl-dev gperf php cmake g++
git clone https://github.com/tdlib/td.git
cd td
git checkout v1.6.0
rm -rf build
mkdir build
cd build
export CXXFLAGS=""
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ..
cmake --build . --target prepare_cross_compiling
cd ..
php SplitSource.php
cd build
cmake --build . --target install
cd ..
php SplitSource.php --undo
cd ..
ls -l /usr/local
after install i want to compile official telegram simple sample given by telegram in the following address :
https://github.com/tdlib/td/blob/master/example/cpp/td_example.cpp
after that i want to compile this example by the following command :
gcc td_example.cpp
but unfortunatelly i get many errors. can anybody please tell me how i can compile this file on ubuntu via terminal console ?
.

Compiling C++ Paho MQTT code gives error "Could not find Paho MQTT C library"

I'm using Ubuntu 16.04, I cloned the c library at ~/Paho_MQTT/paho_c and ran following commands in paho.mqtt.c folder,
sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui
sudo apt-get install fakeroot fakeroot devscripts dh-make lsb-release
sudo apt-get install libssl-dev
sudo apt-get install doxygen graphviz
mkdir build
cd build
ccmake ..
make
sudo make install
All goes well.
Then I cloned c++ code at ~/Paho_MQTT/paho_cpp, and ran following commands in the paho.mqtt.cpp folder,
mkdir build
cd build
cmake -DPAHO_MQTT_C_PATH=~/Paho_MQTT/paho_c/paho.mqtt.c ..
Here I get error, "Could not find Paho MQTT C library",
Can you please suggest any solution ?

Need help to install c++ grpc on ubuntu 16.04

I tried to install grpc by executing the following
git clone -b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
cd grpc
git submodule update --init
make
But when I run make, I get the message "#error This file was generated by an older version of protoc which is"
But, I have the latest protoc installed ...
/usr/bin/protoc --version
libprotoc 3.2.0
Posting an answer to my own question ...
The issue gets resolved when I remove the third party protobuf files before running install.
rm -rf third_party/protobuf
I am not exactly sure why this works though ...

Compiling libsass in Docker container

So I have the following Dockerfile:
############################################################
# Based on Ubuntu
############################################################
FROM ubuntu:trusty
MAINTAINER OTIS WRIGHT
# Add extra software sources
RUN apt-get update -qq
# Libsass requirements.
RUN apt-get install -y curl git build-essential automake libtool
# Fetch sources
RUN git clone https://github.com/sass/libsass.git
RUN git clone https://github.com/sass/sassc.git libsass/sassc
# Create configure script
RUN cd libsass
RUN autoreconf --force --install
RUN cd ..
# Create custom makefiles for **shared library**, for more info read:
# 'Difference between static and shared libraries?' before installing libsass http://stackoverflow.com/q/2649334/802365
RUN cd libsass
RUN autoreconf --force --install
RUN ./configure --disable-tests --enable-shared --prefix=/usr
RUN cd ..
# Build the library
RUN make -C libsass -j5
# Install the library
RUN make -C libsass -j5 install
I am trying to build libsass based on this gist:
https://gist.github.com/edouard-lopez/503d40a5c1a49cf8ae87
However when I try to build with docker I get the following error:
Step 11 : RUN git clone https://github.com/sass/libsass.git
---> Using cache
---> d1a4eef78fa5
Step 12 : RUN git clone https://github.com/sass/sassc.git libsass/sassc
---> Using cache
---> 435410579641
Step 13 : RUN cd libsass
---> Using cache
---> f0a4df503d85
Step 14 : RUN autoreconf --force --install
---> Running in a9b0d51d6ee3
autoreconf: 'configure.ac' or 'configure.in' is required
The command '/bin/sh -c autoreconf --force --install' returned a non-zero code: 1
I don't know a lot about compiling from source so any solutions please walk me through.
Docker won't change dirs for you RUN cd libsass so you need to path your commands or use the WORKDIR directive

Install OpenNi2 and Nite2 on Linux

Im not able to find the website and instructions how to install openni2 and nite2 on linux. Does anyone know where i can find these libs and how to install them?
http://www.linuxdiyf.com/linux/25349.html
This link Have showed how to install Openni2 & NiTE2 in ubuntu 16.04
I reorganized it as follows
sudo apt-get install git g++ cmake libxi-dev libxmu-dev libusb-1.0-0-dev pkg-config freeglut3-dev build-essential
mkdir -p HandTrack/src
cd HandTrack/src
#install libfreenect
git clone https://github.com/OpenKinect/libfreenect.git
cd libfreenect
mkdir build; cd build
cmake .. -DBUILD_OPENNI2_DRIVER=ON
make
sudo make install
sudo mkdir -p /etc/udev/rules.d/
sudo cp ../platform/linux/udev/51-kinect.rules /etc/udev/rules.d/
#install Openni2
cd PATHTO/HandTrack/src
wget https://s3.amazonaws.com/com.occipital.openni/OpenNI-Linux-x64-2.2.0.33.tar.bz2
tar -xjvf OpenNI-Linux-x64-2.2.0.33.tar.bz2 && rm OpenNI-Linux-x64-2.2.0.33.tar.bz2
cd OpenNI-Linux-x64-2.2
sudo ./install.sh
#Test installation of Openni2
cd PATHTO/HandTrack/src
cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so OpenNI-Linux-x64-2.2/Redist/OpenNI2/Drivers/
cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so OpenNI-Linux-x64-2.2/Tools/OpenNI2/Drivers/
sudo apt-get install usbutils
lsusb #You should see kinect devices
cd OpenNI-Linux-x64-2.2/Tools
./NiViewer
#Install NiTE2
cd PATHTO/HandTrack/src
wget http://jaist.dl.sourceforge.net/project/roboticslab/External/nite/NiTE-Linux-x64-2.2.tar.bz2
tar xjvf NiTE-Linux-x64-2.2.tar.bz2 && rm NiTE-Linux-x64-2.2.tar.bz2
cd NiTE-Linux-x64-2.2
sudo ./install.sh
cd ..
cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so NiTE-Linux-x64-2.2/Samples/Bin/OpenNI2/Drivers/
cp OpenNI-Linux-x64-2.2/Redist/libOpenNI2.so NiTE-Linux-x64-2.2/Samples/Bin
cd NiTE-Linux-x64-2.2/Samples/Bin
./UserViewer
The OpenNi2 (and Nite) project was discontiued when apple bought primesense. Using google you may find a million instructions of how or where to find them.
Then again, some other companies have done some updates that may help you. One of this companies is occipital structure:
https://github.com/occipital/openni2
In the github readme you will find the instructions of how to install it in different systems.
Nite2 is a little more difficult to find since the license is different and I think I can't post it here. For the installing instructions, it is similar to the ones of openni2 and are also in the readme file of the package.