commit
8b566d75a8
@ -0,0 +1,9 @@ |
|||||||
|
coverage: |
||||||
|
status: |
||||||
|
project: |
||||||
|
default: false # disable the default status that measures entire project |
||||||
|
pkg: # declare a new status context "pkg" |
||||||
|
paths: |
||||||
|
- pkg/* # only include coverage in "pkg/" folder |
||||||
|
informational: true # Always pass check |
||||||
|
patch: off # disable the commit only checks |
@ -0,0 +1,82 @@ |
|||||||
|
name: Build electron assets |
||||||
|
|
||||||
|
on: |
||||||
|
workflow_dispatch: |
||||||
|
|
||||||
|
jobs: |
||||||
|
build: |
||||||
|
runs-on: ${{ matrix.os }} |
||||||
|
strategy: |
||||||
|
matrix: |
||||||
|
include: |
||||||
|
- os: ubuntu-latest |
||||||
|
arch: amd64 |
||||||
|
build: buildLinux |
||||||
|
- os: ubuntu-latest |
||||||
|
arch: arm64 |
||||||
|
build: buildLinux |
||||||
|
- os: macos-latest |
||||||
|
arch: amd64 |
||||||
|
build: buildIOS |
||||||
|
- os: macos-latest |
||||||
|
arch: arm64 |
||||||
|
build: buildIOS |
||||||
|
- os: windows-latest |
||||||
|
arch: amd64 |
||||||
|
build: buildWindows |
||||||
|
- os: windows-latest |
||||||
|
arch: 386 |
||||||
|
build: buildWindows |
||||||
|
|
||||||
|
steps: |
||||||
|
- name: Checkout code |
||||||
|
uses: actions/checkout@v4 |
||||||
|
|
||||||
|
- name: Setup Go environment |
||||||
|
uses: actions/setup-go@v5 |
||||||
|
with: |
||||||
|
go-version: '1.22' |
||||||
|
|
||||||
|
- name: Check Go version |
||||||
|
run: go version |
||||||
|
|
||||||
|
- name: Install ARM64 cross-compilation toolchain |
||||||
|
if: matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest' |
||||||
|
run: | |
||||||
|
sudo apt-get update |
||||||
|
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu |
||||||
|
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV |
||||||
|
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV |
||||||
|
|
||||||
|
- name: Install MinGW-w64 using Chocolatey |
||||||
|
if: runner.os == 'Windows' && matrix.arch == '386' |
||||||
|
run: | |
||||||
|
curl -L -o mingw32.7z https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z/download |
||||||
|
7z x mingw32.7z -oC:/mingw32 |
||||||
|
|
||||||
|
- name: Setup and build on Windows ${{ matrix.arch }} |
||||||
|
if: runner.os == 'Windows' |
||||||
|
run: | |
||||||
|
./bootstrap_install_mage.bat |
||||||
|
$env:GOARCH="${{ matrix.arch }}" |
||||||
|
if ($env:GOARCH -eq "386") { |
||||||
|
$env:PATH = "C:/mingw32/bin;$env:PATH" |
||||||
|
gcc --version |
||||||
|
$env:CC="gcc -m32" |
||||||
|
$env:CXX="g++ -m32" |
||||||
|
} |
||||||
|
mage ${{ matrix.build }} |
||||||
|
|
||||||
|
- name: Setup and build on ${{ matrix.os }} ${{ matrix.arch }} |
||||||
|
if: runner.os != 'Windows' |
||||||
|
run: | |
||||||
|
sudo bash ./bootstrap_install_mage.sh |
||||||
|
export GOARCH=${{ matrix.arch }} |
||||||
|
sudo -E mage ${{ matrix.build }} |
||||||
|
|
||||||
|
- name: Upload Artifacts |
||||||
|
uses: actions/upload-artifact@v4 |
||||||
|
with: |
||||||
|
name: ${{ matrix.os }}-${{ matrix.arch }}-assets |
||||||
|
path: shared/${{ (matrix.os == 'macos-latest' && 'ios' || (matrix.os == 'windows-latest' && 'windows' || 'linux')) }}/ |
||||||
|
|
@ -0,0 +1,34 @@ |
|||||||
|
# Prerequisites |
||||||
|
*.d |
||||||
|
|
||||||
|
# Compiled Object files |
||||||
|
*.slo |
||||||
|
*.lo |
||||||
|
*.o |
||||||
|
*.obj |
||||||
|
|
||||||
|
# Precompiled Headers |
||||||
|
*.gch |
||||||
|
*.pch |
||||||
|
|
||||||
|
# Compiled Dynamic libraries |
||||||
|
*.so |
||||||
|
*.dylib |
||||||
|
*.dll |
||||||
|
|
||||||
|
# Fortran module files |
||||||
|
|
||||||
|
*.smod |
||||||
|
|
||||||
|
# Compiled Static libraries |
||||||
|
*.lai |
||||||
|
*.la |
||||||
|
*.a |
||||||
|
*.lib |
||||||
|
|
||||||
|
# Executables |
||||||
|
*.exe |
||||||
|
*.out |
||||||
|
*.app |
||||||
|
|
||||||
|
*.vscode |
@ -0,0 +1,661 @@ |
|||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE |
||||||
|
Version 3, 19 November 2007 |
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> |
||||||
|
Everyone is permitted to copy and distribute verbatim copies |
||||||
|
of this license document, but changing it is not allowed. |
||||||
|
|
||||||
|
Preamble |
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for |
||||||
|
software and other kinds of works, specifically designed to ensure |
||||||
|
cooperation with the community in the case of network server software. |
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed |
||||||
|
to take away your freedom to share and change the works. By contrast, |
||||||
|
our General Public Licenses are intended to guarantee your freedom to |
||||||
|
share and change all versions of a program--to make sure it remains free |
||||||
|
software for all its users. |
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not |
||||||
|
price. Our General Public Licenses are designed to make sure that you |
||||||
|
have the freedom to distribute copies of free software (and charge for |
||||||
|
them if you wish), that you receive source code or can get it if you |
||||||
|
want it, that you can change the software or use pieces of it in new |
||||||
|
free programs, and that you know you can do these things. |
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights |
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer |
||||||
|
you this License which gives you legal permission to copy, distribute |
||||||
|
and/or modify the software. |
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that |
||||||
|
improvements made in alternate versions of the program, if they |
||||||
|
receive widespread use, become available for other developers to |
||||||
|
incorporate. Many developers of free software are heartened and |
||||||
|
encouraged by the resulting cooperation. However, in the case of |
||||||
|
software used on network servers, this result may fail to come about. |
||||||
|
The GNU General Public License permits making a modified version and |
||||||
|
letting the public access it on a server without ever releasing its |
||||||
|
source code to the public. |
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to |
||||||
|
ensure that, in such cases, the modified source code becomes available |
||||||
|
to the community. It requires the operator of a network server to |
||||||
|
provide the source code of the modified version running there to the |
||||||
|
users of that server. Therefore, public use of a modified version, on |
||||||
|
a publicly accessible server, gives the public access to the source |
||||||
|
code of the modified version. |
||||||
|
|
||||||
|
An older license, called the Affero General Public License and |
||||||
|
published by Affero, was designed to accomplish similar goals. This is |
||||||
|
a different license, not a version of the Affero GPL, but Affero has |
||||||
|
released a new version of the Affero GPL which permits relicensing under |
||||||
|
this license. |
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and |
||||||
|
modification follow. |
||||||
|
|
||||||
|
TERMS AND CONDITIONS |
||||||
|
|
||||||
|
0. Definitions. |
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License. |
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of |
||||||
|
works, such as semiconductor masks. |
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this |
||||||
|
License. Each licensee is addressed as "you". "Licensees" and |
||||||
|
"recipients" may be individuals or organizations. |
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work |
||||||
|
in a fashion requiring copyright permission, other than the making of an |
||||||
|
exact copy. The resulting work is called a "modified version" of the |
||||||
|
earlier work or a work "based on" the earlier work. |
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based |
||||||
|
on the Program. |
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without |
||||||
|
permission, would make you directly or secondarily liable for |
||||||
|
infringement under applicable copyright law, except executing it on a |
||||||
|
computer or modifying a private copy. Propagation includes copying, |
||||||
|
distribution (with or without modification), making available to the |
||||||
|
public, and in some countries other activities as well. |
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other |
||||||
|
parties to make or receive copies. Mere interaction with a user through |
||||||
|
a computer network, with no transfer of a copy, is not conveying. |
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" |
||||||
|
to the extent that it includes a convenient and prominently visible |
||||||
|
feature that (1) displays an appropriate copyright notice, and (2) |
||||||
|
tells the user that there is no warranty for the work (except to the |
||||||
|
extent that warranties are provided), that licensees may convey the |
||||||
|
work under this License, and how to view a copy of this License. If |
||||||
|
the interface presents a list of user commands or options, such as a |
||||||
|
menu, a prominent item in the list meets this criterion. |
||||||
|
|
||||||
|
1. Source Code. |
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work |
||||||
|
for making modifications to it. "Object code" means any non-source |
||||||
|
form of a work. |
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official |
||||||
|
standard defined by a recognized standards body, or, in the case of |
||||||
|
interfaces specified for a particular programming language, one that |
||||||
|
is widely used among developers working in that language. |
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other |
||||||
|
than the work as a whole, that (a) is included in the normal form of |
||||||
|
packaging a Major Component, but which is not part of that Major |
||||||
|
Component, and (b) serves only to enable use of the work with that |
||||||
|
Major Component, or to implement a Standard Interface for which an |
||||||
|
implementation is available to the public in source code form. A |
||||||
|
"Major Component", in this context, means a major essential component |
||||||
|
(kernel, window system, and so on) of the specific operating system |
||||||
|
(if any) on which the executable work runs, or a compiler used to |
||||||
|
produce the work, or an object code interpreter used to run it. |
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all |
||||||
|
the source code needed to generate, install, and (for an executable |
||||||
|
work) run the object code and to modify the work, including scripts to |
||||||
|
control those activities. However, it does not include the work's |
||||||
|
System Libraries, or general-purpose tools or generally available free |
||||||
|
programs which are used unmodified in performing those activities but |
||||||
|
which are not part of the work. For example, Corresponding Source |
||||||
|
includes interface definition files associated with source files for |
||||||
|
the work, and the source code for shared libraries and dynamically |
||||||
|
linked subprograms that the work is specifically designed to require, |
||||||
|
such as by intimate data communication or control flow between those |
||||||
|
subprograms and other parts of the work. |
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users |
||||||
|
can regenerate automatically from other parts of the Corresponding |
||||||
|
Source. |
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that |
||||||
|
same work. |
||||||
|
|
||||||
|
2. Basic Permissions. |
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of |
||||||
|
copyright on the Program, and are irrevocable provided the stated |
||||||
|
conditions are met. This License explicitly affirms your unlimited |
||||||
|
permission to run the unmodified Program. The output from running a |
||||||
|
covered work is covered by this License only if the output, given its |
||||||
|
content, constitutes a covered work. This License acknowledges your |
||||||
|
rights of fair use or other equivalent, as provided by copyright law. |
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not |
||||||
|
convey, without conditions so long as your license otherwise remains |
||||||
|
in force. You may convey covered works to others for the sole purpose |
||||||
|
of having them make modifications exclusively for you, or provide you |
||||||
|
with facilities for running those works, provided that you comply with |
||||||
|
the terms of this License in conveying all material for which you do |
||||||
|
not control copyright. Those thus making or running the covered works |
||||||
|
for you must do so exclusively on your behalf, under your direction |
||||||
|
and control, on terms that prohibit them from making any copies of |
||||||
|
your copyrighted material outside their relationship with you. |
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under |
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10 |
||||||
|
makes it unnecessary. |
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological |
||||||
|
measure under any applicable law fulfilling obligations under article |
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or |
||||||
|
similar laws prohibiting or restricting circumvention of such |
||||||
|
measures. |
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid |
||||||
|
circumvention of technological measures to the extent such circumvention |
||||||
|
is effected by exercising rights under this License with respect to |
||||||
|
the covered work, and you disclaim any intention to limit operation or |
||||||
|
modification of the work as a means of enforcing, against the work's |
||||||
|
users, your or third parties' legal rights to forbid circumvention of |
||||||
|
technological measures. |
||||||
|
|
||||||
|
4. Conveying Verbatim Copies. |
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you |
||||||
|
receive it, in any medium, provided that you conspicuously and |
||||||
|
appropriately publish on each copy an appropriate copyright notice; |
||||||
|
keep intact all notices stating that this License and any |
||||||
|
non-permissive terms added in accord with section 7 apply to the code; |
||||||
|
keep intact all notices of the absence of any warranty; and give all |
||||||
|
recipients a copy of this License along with the Program. |
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, |
||||||
|
and you may offer support or warranty protection for a fee. |
||||||
|
|
||||||
|
5. Conveying Modified Source Versions. |
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to |
||||||
|
produce it from the Program, in the form of source code under the |
||||||
|
terms of section 4, provided that you also meet all of these conditions: |
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified |
||||||
|
it, and giving a relevant date. |
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is |
||||||
|
released under this License and any conditions added under section |
||||||
|
7. This requirement modifies the requirement in section 4 to |
||||||
|
"keep intact all notices". |
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this |
||||||
|
License to anyone who comes into possession of a copy. This |
||||||
|
License will therefore apply, along with any applicable section 7 |
||||||
|
additional terms, to the whole of the work, and all its parts, |
||||||
|
regardless of how they are packaged. This License gives no |
||||||
|
permission to license the work in any other way, but it does not |
||||||
|
invalidate such permission if you have separately received it. |
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display |
||||||
|
Appropriate Legal Notices; however, if the Program has interactive |
||||||
|
interfaces that do not display Appropriate Legal Notices, your |
||||||
|
work need not make them do so. |
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent |
||||||
|
works, which are not by their nature extensions of the covered work, |
||||||
|
and which are not combined with it such as to form a larger program, |
||||||
|
in or on a volume of a storage or distribution medium, is called an |
||||||
|
"aggregate" if the compilation and its resulting copyright are not |
||||||
|
used to limit the access or legal rights of the compilation's users |
||||||
|
beyond what the individual works permit. Inclusion of a covered work |
||||||
|
in an aggregate does not cause this License to apply to the other |
||||||
|
parts of the aggregate. |
||||||
|
|
||||||
|
6. Conveying Non-Source Forms. |
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms |
||||||
|
of sections 4 and 5, provided that you also convey the |
||||||
|
machine-readable Corresponding Source under the terms of this License, |
||||||
|
in one of these ways: |
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product |
||||||
|
(including a physical distribution medium), accompanied by the |
||||||
|
Corresponding Source fixed on a durable physical medium |
||||||
|
customarily used for software interchange. |
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product |
||||||
|
(including a physical distribution medium), accompanied by a |
||||||
|
written offer, valid for at least three years and valid for as |
||||||
|
long as you offer spare parts or customer support for that product |
||||||
|
model, to give anyone who possesses the object code either (1) a |
||||||
|
copy of the Corresponding Source for all the software in the |
||||||
|
product that is covered by this License, on a durable physical |
||||||
|
medium customarily used for software interchange, for a price no |
||||||
|
more than your reasonable cost of physically performing this |
||||||
|
conveying of source, or (2) access to copy the |
||||||
|
Corresponding Source from a network server at no charge. |
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the |
||||||
|
written offer to provide the Corresponding Source. This |
||||||
|
alternative is allowed only occasionally and noncommercially, and |
||||||
|
only if you received the object code with such an offer, in accord |
||||||
|
with subsection 6b. |
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated |
||||||
|
place (gratis or for a charge), and offer equivalent access to the |
||||||
|
Corresponding Source in the same way through the same place at no |
||||||
|
further charge. You need not require recipients to copy the |
||||||
|
Corresponding Source along with the object code. If the place to |
||||||
|
copy the object code is a network server, the Corresponding Source |
||||||
|
may be on a different server (operated by you or a third party) |
||||||
|
that supports equivalent copying facilities, provided you maintain |
||||||
|
clear directions next to the object code saying where to find the |
||||||
|
Corresponding Source. Regardless of what server hosts the |
||||||
|
Corresponding Source, you remain obligated to ensure that it is |
||||||
|
available for as long as needed to satisfy these requirements. |
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided |
||||||
|
you inform other peers where the object code and Corresponding |
||||||
|
Source of the work are being offered to the general public at no |
||||||
|
charge under subsection 6d. |
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded |
||||||
|
from the Corresponding Source as a System Library, need not be |
||||||
|
included in conveying the object code work. |
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any |
||||||
|
tangible personal property which is normally used for personal, family, |
||||||
|
or household purposes, or (2) anything designed or sold for incorporation |
||||||
|
into a dwelling. In determining whether a product is a consumer product, |
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular |
||||||
|
product received by a particular user, "normally used" refers to a |
||||||
|
typical or common use of that class of product, regardless of the status |
||||||
|
of the particular user or of the way in which the particular user |
||||||
|
actually uses, or expects or is expected to use, the product. A product |
||||||
|
is a consumer product regardless of whether the product has substantial |
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent |
||||||
|
the only significant mode of use of the product. |
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods, |
||||||
|
procedures, authorization keys, or other information required to install |
||||||
|
and execute modified versions of a covered work in that User Product from |
||||||
|
a modified version of its Corresponding Source. The information must |
||||||
|
suffice to ensure that the continued functioning of the modified object |
||||||
|
code is in no case prevented or interfered with solely because |
||||||
|
modification has been made. |
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or |
||||||
|
specifically for use in, a User Product, and the conveying occurs as |
||||||
|
part of a transaction in which the right of possession and use of the |
||||||
|
User Product is transferred to the recipient in perpetuity or for a |
||||||
|
fixed term (regardless of how the transaction is characterized), the |
||||||
|
Corresponding Source conveyed under this section must be accompanied |
||||||
|
by the Installation Information. But this requirement does not apply |
||||||
|
if neither you nor any third party retains the ability to install |
||||||
|
modified object code on the User Product (for example, the work has |
||||||
|
been installed in ROM). |
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a |
||||||
|
requirement to continue to provide support service, warranty, or updates |
||||||
|
for a work that has been modified or installed by the recipient, or for |
||||||
|
the User Product in which it has been modified or installed. Access to a |
||||||
|
network may be denied when the modification itself materially and |
||||||
|
adversely affects the operation of the network or violates the rules and |
||||||
|
protocols for communication across the network. |
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, |
||||||
|
in accord with this section must be in a format that is publicly |
||||||
|
documented (and with an implementation available to the public in |
||||||
|
source code form), and must require no special password or key for |
||||||
|
unpacking, reading or copying. |
||||||
|
|
||||||
|
7. Additional Terms. |
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this |
||||||
|
License by making exceptions from one or more of its conditions. |
||||||
|
Additional permissions that are applicable to the entire Program shall |
||||||
|
be treated as though they were included in this License, to the extent |
||||||
|
that they are valid under applicable law. If additional permissions |
||||||
|
apply only to part of the Program, that part may be used separately |
||||||
|
under those permissions, but the entire Program remains governed by |
||||||
|
this License without regard to the additional permissions. |
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option |
||||||
|
remove any additional permissions from that copy, or from any part of |
||||||
|
it. (Additional permissions may be written to require their own |
||||||
|
removal in certain cases when you modify the work.) You may place |
||||||
|
additional permissions on material, added by you to a covered work, |
||||||
|
for which you have or can give appropriate copyright permission. |
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you |
||||||
|
add to a covered work, you may (if authorized by the copyright holders of |
||||||
|
that material) supplement the terms of this License with terms: |
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the |
||||||
|
terms of sections 15 and 16 of this License; or |
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or |
||||||
|
author attributions in that material or in the Appropriate Legal |
||||||
|
Notices displayed by works containing it; or |
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or |
||||||
|
requiring that modified versions of such material be marked in |
||||||
|
reasonable ways as different from the original version; or |
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or |
||||||
|
authors of the material; or |
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some |
||||||
|
trade names, trademarks, or service marks; or |
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that |
||||||
|
material by anyone who conveys the material (or modified versions of |
||||||
|
it) with contractual assumptions of liability to the recipient, for |
||||||
|
any liability that these contractual assumptions directly impose on |
||||||
|
those licensors and authors. |
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further |
||||||
|
restrictions" within the meaning of section 10. If the Program as you |
||||||
|
received it, or any part of it, contains a notice stating that it is |
||||||
|
governed by this License along with a term that is a further |
||||||
|
restriction, you may remove that term. If a license document contains |
||||||
|
a further restriction but permits relicensing or conveying under this |
||||||
|
License, you may add to a covered work material governed by the terms |
||||||
|
of that license document, provided that the further restriction does |
||||||
|
not survive such relicensing or conveying. |
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you |
||||||
|
must place, in the relevant source files, a statement of the |
||||||
|
additional terms that apply to those files, or a notice indicating |
||||||
|
where to find the applicable terms. |
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the |
||||||
|
form of a separately written license, or stated as exceptions; |
||||||
|
the above requirements apply either way. |
||||||
|
|
||||||
|
8. Termination. |
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly |
||||||
|
provided under this License. Any attempt otherwise to propagate or |
||||||
|
modify it is void, and will automatically terminate your rights under |
||||||
|
this License (including any patent licenses granted under the third |
||||||
|
paragraph of section 11). |
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your |
||||||
|
license from a particular copyright holder is reinstated (a) |
||||||
|
provisionally, unless and until the copyright holder explicitly and |
||||||
|
finally terminates your license, and (b) permanently, if the copyright |
||||||
|
holder fails to notify you of the violation by some reasonable means |
||||||
|
prior to 60 days after the cessation. |
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is |
||||||
|
reinstated permanently if the copyright holder notifies you of the |
||||||
|
violation by some reasonable means, this is the first time you have |
||||||
|
received notice of violation of this License (for any work) from that |
||||||
|
copyright holder, and you cure the violation prior to 30 days after |
||||||
|
your receipt of the notice. |
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the |
||||||
|
licenses of parties who have received copies or rights from you under |
||||||
|
this License. If your rights have been terminated and not permanently |
||||||
|
reinstated, you do not qualify to receive new licenses for the same |
||||||
|
material under section 10. |
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies. |
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or |
||||||
|
run a copy of the Program. Ancillary propagation of a covered work |
||||||
|
occurring solely as a consequence of using peer-to-peer transmission |
||||||
|
to receive a copy likewise does not require acceptance. However, |
||||||
|
nothing other than this License grants you permission to propagate or |
||||||
|
modify any covered work. These actions infringe copyright if you do |
||||||
|
not accept this License. Therefore, by modifying or propagating a |
||||||
|
covered work, you indicate your acceptance of this License to do so. |
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients. |
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically |
||||||
|
receives a license from the original licensors, to run, modify and |
||||||
|
propagate that work, subject to this License. You are not responsible |
||||||
|
for enforcing compliance by third parties with this License. |
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an |
||||||
|
organization, or substantially all assets of one, or subdividing an |
||||||
|
organization, or merging organizations. If propagation of a covered |
||||||
|
work results from an entity transaction, each party to that |
||||||
|
transaction who receives a copy of the work also receives whatever |
||||||
|
licenses to the work the party's predecessor in interest had or could |
||||||
|
give under the previous paragraph, plus a right to possession of the |
||||||
|
Corresponding Source of the work from the predecessor in interest, if |
||||||
|
the predecessor has it or can get it with reasonable efforts. |
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the |
||||||
|
rights granted or affirmed under this License. For example, you may |
||||||
|
not impose a license fee, royalty, or other charge for exercise of |
||||||
|
rights granted under this License, and you may not initiate litigation |
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that |
||||||
|
any patent claim is infringed by making, using, selling, offering for |
||||||
|
sale, or importing the Program or any portion of it. |
||||||
|
|
||||||
|
11. Patents. |
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this |
||||||
|
License of the Program or a work on which the Program is based. The |
||||||
|
work thus licensed is called the contributor's "contributor version". |
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims |
||||||
|
owned or controlled by the contributor, whether already acquired or |
||||||
|
hereafter acquired, that would be infringed by some manner, permitted |
||||||
|
by this License, of making, using, or selling its contributor version, |
||||||
|
but do not include claims that would be infringed only as a |
||||||
|
consequence of further modification of the contributor version. For |
||||||
|
purposes of this definition, "control" includes the right to grant |
||||||
|
patent sublicenses in a manner consistent with the requirements of |
||||||
|
this License. |
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free |
||||||
|
patent license under the contributor's essential patent claims, to |
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and |
||||||
|
propagate the contents of its contributor version. |
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express |
||||||
|
agreement or commitment, however denominated, not to enforce a patent |
||||||
|
(such as an express permission to practice a patent or covenant not to |
||||||
|
sue for patent infringement). To "grant" such a patent license to a |
||||||
|
party means to make such an agreement or commitment not to enforce a |
||||||
|
patent against the party. |
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, |
||||||
|
and the Corresponding Source of the work is not available for anyone |
||||||
|
to copy, free of charge and under the terms of this License, through a |
||||||
|
publicly available network server or other readily accessible means, |
||||||
|
then you must either (1) cause the Corresponding Source to be so |
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the |
||||||
|
patent license for this particular work, or (3) arrange, in a manner |
||||||
|
consistent with the requirements of this License, to extend the patent |
||||||
|
license to downstream recipients. "Knowingly relying" means you have |
||||||
|
actual knowledge that, but for the patent license, your conveying the |
||||||
|
covered work in a country, or your recipient's use of the covered work |
||||||
|
in a country, would infringe one or more identifiable patents in that |
||||||
|
country that you have reason to believe are valid. |
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or |
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a |
||||||
|
covered work, and grant a patent license to some of the parties |
||||||
|
receiving the covered work authorizing them to use, propagate, modify |
||||||
|
or convey a specific copy of the covered work, then the patent license |
||||||
|
you grant is automatically extended to all recipients of the covered |
||||||
|
work and works based on it. |
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within |
||||||
|
the scope of its coverage, prohibits the exercise of, or is |
||||||
|
conditioned on the non-exercise of one or more of the rights that are |
||||||
|
specifically granted under this License. You may not convey a covered |
||||||
|
work if you are a party to an arrangement with a third party that is |
||||||
|
in the business of distributing software, under which you make payment |
||||||
|
to the third party based on the extent of your activity of conveying |
||||||
|
the work, and under which the third party grants, to any of the |
||||||
|
parties who would receive the covered work from you, a discriminatory |
||||||
|
patent license (a) in connection with copies of the covered work |
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily |
||||||
|
for and in connection with specific products or compilations that |
||||||
|
contain the covered work, unless you entered into that arrangement, |
||||||
|
or that patent license was granted, prior to 28 March 2007. |
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting |
||||||
|
any implied license or other defenses to infringement that may |
||||||
|
otherwise be available to you under applicable patent law. |
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom. |
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or |
||||||
|
otherwise) that contradict the conditions of this License, they do not |
||||||
|
excuse you from the conditions of this License. If you cannot convey a |
||||||
|
covered work so as to satisfy simultaneously your obligations under this |
||||||
|
License and any other pertinent obligations, then as a consequence you may |
||||||
|
not convey it at all. For example, if you agree to terms that obligate you |
||||||
|
to collect a royalty for further conveying from those to whom you convey |
||||||
|
the Program, the only way you could satisfy both those terms and this |
||||||
|
License would be to refrain entirely from conveying the Program. |
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License. |
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the |
||||||
|
Program, your modified version must prominently offer all users |
||||||
|
interacting with it remotely through a computer network (if your version |
||||||
|
supports such interaction) an opportunity to receive the Corresponding |
||||||
|
Source of your version by providing access to the Corresponding Source |
||||||
|
from a network server at no charge, through some standard or customary |
||||||
|
means of facilitating copying of software. This Corresponding Source |
||||||
|
shall include the Corresponding Source for any work covered by version 3 |
||||||
|
of the GNU General Public License that is incorporated pursuant to the |
||||||
|
following paragraph. |
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have |
||||||
|
permission to link or combine any covered work with a work licensed |
||||||
|
under version 3 of the GNU General Public License into a single |
||||||
|
combined work, and to convey the resulting work. The terms of this |
||||||
|
License will continue to apply to the part which is the covered work, |
||||||
|
but the work with which it is combined will remain governed by version |
||||||
|
3 of the GNU General Public License. |
||||||
|
|
||||||
|
14. Revised Versions of this License. |
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of |
||||||
|
the GNU Affero General Public License from time to time. Such new versions |
||||||
|
will be similar in spirit to the present version, but may differ in detail to |
||||||
|
address new problems or concerns. |
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the |
||||||
|
Program specifies that a certain numbered version of the GNU Affero General |
||||||
|
Public License "or any later version" applies to it, you have the |
||||||
|
option of following the terms and conditions either of that numbered |
||||||
|
version or of any later version published by the Free Software |
||||||
|
Foundation. If the Program does not specify a version number of the |
||||||
|
GNU Affero General Public License, you may choose any version ever published |
||||||
|
by the Free Software Foundation. |
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future |
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's |
||||||
|
public statement of acceptance of a version permanently authorizes you |
||||||
|
to choose that version for the Program. |
||||||
|
|
||||||
|
Later license versions may give you additional or different |
||||||
|
permissions. However, no additional obligations are imposed on any |
||||||
|
author or copyright holder as a result of your choosing to follow a |
||||||
|
later version. |
||||||
|
|
||||||
|
15. Disclaimer of Warranty. |
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
||||||
|
|
||||||
|
16. Limitation of Liability. |
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
||||||
|
SUCH DAMAGES. |
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16. |
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided |
||||||
|
above cannot be given local legal effect according to their terms, |
||||||
|
reviewing courts shall apply local law that most closely approximates |
||||||
|
an absolute waiver of all civil liability in connection with the |
||||||
|
Program, unless a warranty or assumption of liability accompanies a |
||||||
|
copy of the Program in return for a fee. |
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS |
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs |
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest |
||||||
|
possible use to the public, the best way to achieve this is to make it |
||||||
|
free software which everyone can redistribute and change under these terms. |
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest |
||||||
|
to attach them to the start of each source file to most effectively |
||||||
|
state the exclusion of warranty; and each file should have at least |
||||||
|
the "copyright" line and a pointer to where the full notice is found. |
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.> |
||||||
|
Copyright (C) <year> <name of author> |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU Affero General Public License as published |
||||||
|
by the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU Affero General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License |
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail. |
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer |
||||||
|
network, you should also make sure that it provides a way for users to |
||||||
|
get its source. For example, if your program is a web application, its |
||||||
|
interface could display a "Source" link that leads users to an archive |
||||||
|
of the code. There are many ways you could offer source, and different |
||||||
|
solutions will be better for different programs; see section 13 for the |
||||||
|
specific requirements. |
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, |
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary. |
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see |
||||||
|
<https://www.gnu.org/licenses/>. |
@ -0,0 +1,95 @@ |
|||||||
|
# openim-sdk-cpp |
||||||
|
|
||||||
|
openim-sdk-cpp is the C language export layer for the [openim-sdk-core](https://github.com/openimsdk/openim-sdk-core) repository, designed to provide a simple integration method for C/C++ developers. With this SDK, developers can easily integrate OpenIM real-time messaging services into their C/C++ applications, enabling efficient handling of instant messaging, chat management, message pushing, and other features. |
||||||
|
|
||||||
|
## Setup |
||||||
|
### 1. Setting Up Go Environment |
||||||
|
To get started, you need to set up the Go development environment. You can download and install Go from the [official Go website](https://go.dev/). |
||||||
|
|
||||||
|
After installation, verify that Go is correctly installed by running: |
||||||
|
``` |
||||||
|
go version |
||||||
|
``` |
||||||
|
### 2. Installing Mage |
||||||
|
mage is a Go-based build tool used for running various tasks within the project. To install mage, follow these steps: |
||||||
|
|
||||||
|
1. Run the following command to install the mage tool: |
||||||
|
``` |
||||||
|
# mac or linux |
||||||
|
./bootstrap_install_mage.sh |
||||||
|
# windows |
||||||
|
./bootstrap_install_mage.bat |
||||||
|
``` |
||||||
|
2. Once installed, you can list all available mage commands by running: |
||||||
|
``` |
||||||
|
mage -l |
||||||
|
# like below |
||||||
|
mage -l |
||||||
|
Targets: |
||||||
|
build* BuildAll compiles the project for all platforms. |
||||||
|
buildAndroid compiles the project for Android. |
||||||
|
buildIOS compiles the project for iOS. |
||||||
|
buildLinux compiles the project for Linux. |
||||||
|
buildWindows compiles the project for Windows. |
||||||
|
|
||||||
|
* default target |
||||||
|
``` |
||||||
|
|
||||||
|
### 3. Generating C Dynamic Library |
||||||
|
You can generate the required C dynamic library for your project using the mage tool. Here’s an example of how to build the C dynamic library: |
||||||
|
``` |
||||||
|
mage buildWindows |
||||||
|
Building for Windows... |
||||||
|
go: downloading github.com/openimsdk/openim-sdk-core/v3 v3.8.1 |
||||||
|
go: downloading github.com/openimsdk/protocol v0.0.72-alpha.24 |
||||||
|
go: downloading github.com/openimsdk/tools v0.0.50-alpha.14 |
||||||
|
# github.com/openimsdk/protocol/user |
||||||
|
``` |
||||||
|
This command will generate the appropriate C dynamic library file for your platform (e.g., libopenimsdk.so, libopenimsdk.dylib, etc.). |
||||||
|
# Using the C SDK in Your Project |
||||||
|
After generating the dynamic library, you can link it to your C/C++ project. Below are the general steps for using the SDK: |
||||||
|
### 1. Initialize the SDK |
||||||
|
First, initialize the SDK in your project: |
||||||
|
|
||||||
|
``` |
||||||
|
extern __declspec(dllexport) GoUint8 init_sdk(CB_I_S cCallback, char* operationID, char* config); |
||||||
|
``` |
||||||
|
### 2. Set Up Listeners |
||||||
|
Set up listeners for various events such as message reception, login status, etc.: |
||||||
|
``` |
||||||
|
extern __declspec(dllexport) void set_group_listener(CB_I_S cCallback); |
||||||
|
extern __declspec(dllexport) void set_conversation_listener(CB_I_S cCallback); |
||||||
|
extern __declspec(dllexport) void set_advanced_msg_listener(CB_I_S cCallback); |
||||||
|
extern __declspec(dllexport) void set_batch_msg_listener(CB_I_S cCallback); |
||||||
|
extern __declspec(dllexport) void set_user_listener(CB_I_S cCallback); |
||||||
|
extern __declspec(dllexport) void set_friend_listener(CB_I_S cCallback); |
||||||
|
extern __declspec(dllexport) void set_custom_business_listener(CB_I_S cCallback); |
||||||
|
``` |
||||||
|
### 3. Login |
||||||
|
Use the login function to start the sdk: |
||||||
|
``` |
||||||
|
extern __declspec(dllexport) void login(CB_S_I_S_S cCallback, char* operationID, char* uid, char* token); |
||||||
|
``` |
||||||
|
### 4. Call Other Interfaces |
||||||
|
``` |
||||||
|
extern __declspec(dllexport) char* create_text_message(char* operationID, char* text); |
||||||
|
extern __declspec(dllexport) void send_message(CB_S_I_S_S_I cCallback, char* operationID, char* message, char* recvID, char* groupID, char* offlinePushInfo, int isOnlineOnly); |
||||||
|
|
||||||
|
``` |
||||||
|
Once the login is successful, you can use other SDK methods to interact with OpenIM services, such as sending messages, creating groups, and more. |
||||||
|
|
||||||
|
For detailed usage and API reference, please refer to the documentation in the openim-sdk-core repository. |
||||||
|
|
||||||
|
# License |
||||||
|
This software is licensed under a dual-license model: |
||||||
|
|
||||||
|
- The GNU Affero General Public License (AGPL), Version 3 or later; **OR** |
||||||
|
- Commercial license terms from OpenIMSDK. |
||||||
|
|
||||||
|
If you wish to use this software under commercial terms, please contact us at: contact@openim.io |
||||||
|
|
||||||
|
For more information, see: https://www.openim.io/en/licensing |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@ |
|||||||
|
@echo off |
||||||
|
SETLOCAL |
||||||
|
|
||||||
|
mage -version >nul 2>&1 |
||||||
|
IF %ERRORLEVEL% EQU 0 ( |
||||||
|
echo Mage is already installed. |
||||||
|
GOTO DOWNLOAD |
||||||
|
) |
||||||
|
|
||||||
|
go version >nul 2>&1 |
||||||
|
IF NOT %ERRORLEVEL% EQU 0 ( |
||||||
|
echo Go is not installed. Please install Go and try again. |
||||||
|
exit /b 1 |
||||||
|
) |
||||||
|
|
||||||
|
echo Installing Mage... |
||||||
|
go install github.com/magefile/mage@latest |
||||||
|
|
||||||
|
mage -version >nul 2>&1 |
||||||
|
IF NOT %ERRORLEVEL% EQU 0 ( |
||||||
|
echo Mage installation failed. |
||||||
|
echo Please ensure that %GOPATH%/bin is in your PATH. |
||||||
|
exit /b 1 |
||||||
|
) |
||||||
|
|
||||||
|
echo Mage installed successfully. |
||||||
|
|
||||||
|
:DOWNLOAD |
||||||
|
go mod download |
||||||
|
|
||||||
|
ENDLOCAL |
@ -0,0 +1,21 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then |
||||||
|
TARGET_DIR="$HOME/.local/bin" |
||||||
|
else |
||||||
|
TARGET_DIR="/usr/local/bin" |
||||||
|
echo "Using /usr/local/bin as the installation directory. Might require sudo permissions." |
||||||
|
fi |
||||||
|
|
||||||
|
if ! command -v mage &> /dev/null; then |
||||||
|
echo "Installing Mage to $TARGET_DIR ..." |
||||||
|
GOBIN=$TARGET_DIR go install github.com/magefile/mage@latest |
||||||
|
fi |
||||||
|
|
||||||
|
if ! command -v mage &> /dev/null; then |
||||||
|
echo "Mage installation failed." |
||||||
|
echo "Please ensure that $TARGET_DIR is in your \$PATH." |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
echo "Mage installed successfully." |
@ -0,0 +1,20 @@ |
|||||||
|
cmake_minimum_required(VERSION 3.12) |
||||||
|
project(test_project) |
||||||
|
|
||||||
|
Set source code files |
||||||
|
set(SOURCE_FILES test.c) |
||||||
|
|
||||||
|
Set dynamic library file path |
||||||
|
set(LIBRARY_PATH ../shared/windows) |
||||||
|
|
||||||
|
Set dynamic library file name |
||||||
|
set(LIBRARY_NAME libopenimsdk) |
||||||
|
|
||||||
|
Add executable |
||||||
|
add_executable(test.exe ${SOURCE_FILES}) |
||||||
|
|
||||||
|
Add library directory for linking |
||||||
|
link_directories(${LIBRARY_PATH}) |
||||||
|
|
||||||
|
Add library for linking |
||||||
|
target_link_libraries(test.exe ${LIBRARY_NAME}) |
@ -0,0 +1 @@ |
|||||||
|
# openim-sdk-cpp |
@ -0,0 +1,66 @@ |
|||||||
|
// gcc -o test.exe -lc_wrapper.dll test.c
|
||||||
|
#include <stdio.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <unistd.h> |
||||||
|
|
||||||
|
#include "../include/libopenimsdk.h" |
||||||
|
|
||||||
|
typedef struct |
||||||
|
{ |
||||||
|
GoUint32 platformID; |
||||||
|
char apiAddr[256]; |
||||||
|
char wsAddr[256]; |
||||||
|
char dataDir[256]; |
||||||
|
GoUint32 logLevel; |
||||||
|
GoUint8 isLogStandardOutput; |
||||||
|
char logFilePath[256]; |
||||||
|
GoUint8 isExternalExtensions; |
||||||
|
} IMConfigC; |
||||||
|
|
||||||
|
void c_conn_callback(int event, char *data) |
||||||
|
{ |
||||||
|
printf("C c_conn_callback receive from Go callbck code: %d,data: %s\n", event,data); |
||||||
|
|
||||||
|
} |
||||||
|
void c_conversation_callback(int event, char *data) |
||||||
|
{ |
||||||
|
printf("C c_conversation_callback receive from Go callbck code: %d,data: %s\n", event, data); |
||||||
|
} |
||||||
|
void c_message_callback(int event, char *data) |
||||||
|
{ |
||||||
|
printf("C c_message_callback receive from Go callbck code: %d,data: %s\n", event, data); |
||||||
|
} |
||||||
|
void c_base_callback(char * operationID ,int errCode,char * errMsg,char *data) |
||||||
|
{ |
||||||
|
printf("C c_base_callback operationID: %s receive from Go callbck code: %d, errMsg: %s, data: %s\n", operationID, errCode, errMsg, data); |
||||||
|
} |
||||||
|
int main(int argc, char **argv) |
||||||
|
{ |
||||||
|
char operationID[] = "12345"; |
||||||
|
// char uid[] = "6959062403";
|
||||||
|
char uid[] = "openIM123"; |
||||||
|
// char token[] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiI2OTU5MDYyNDAzIiwiUGxhdGZvcm1JRCI6MywiZXhwIjoxNzAwNzIwOTg0LCJuYmYiOjE2OTI5NDQ2ODQsImlhdCI6MTY5Mjk0NDk4NH0.8otKTFrOCs8_ueV10rNOD-rzHrCT_EN0obKS9q79bIc";
|
||||||
|
char token[] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJvcGVuSU0xMjMiLCJQbGF0Zm9ybUlEIjo2LCJleHAiOjE3MDkxMjQ2NzYsIm5iZiI6MTcwMTM0ODM3NiwiaWF0IjoxNzAxMzQ4Njc2fQ.EqlV5TlpiElYhUOHCEcSrZOWi9ldrUMR1L4q0blvxs0"; |
||||||
|
|
||||||
|
char *jsonString = "{\"platformID\": 2, \"apiAddr\": \"http://14.29.168.56:10002\", \"wsAddr\":\"ws://14.29.168.56:10001\",\"dataDir\": \"./\", \"logLevel\": 5, \"isLogStandardOutput\": true, \"logFilePath\": \"./\", \"isExternalExtensions\": true}"; |
||||||
|
|
||||||
|
GoUint8 init_result; |
||||||
|
init_result = init_sdk(c_conn_callback,operationID, jsonString); |
||||||
|
printf("init_result: %u\n", init_result); |
||||||
|
set_conversation_listener(c_conversation_callback); |
||||||
|
set_advanced_msg_listener(c_message_callback); |
||||||
|
login(c_base_callback, operationID, uid, token); |
||||||
|
sleep(10); |
||||||
|
// char text[] = "hello";
|
||||||
|
char* loginUserID=get_login_user(); |
||||||
|
|
||||||
|
printf("return :%s\n",loginUserID); |
||||||
|
char operationID1[] = "12345,create"; |
||||||
|
char *message = create_text_message(operationID1, "hello"); |
||||||
|
printf("return :%s\n",message); |
||||||
|
char operationID2[] = "12345,get_all_conversation_list"; |
||||||
|
get_all_conversation_list(c_base_callback, operationID2); |
||||||
|
|
||||||
|
sleep(1000000); |
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
# openim-sdk-cpp |
@ -0,0 +1,328 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
#include "libopenimsdk.h" |
||||||
|
#include <functional> |
||||||
|
#include <string> |
||||||
|
#include <memory> |
||||||
|
#include <iostream> |
||||||
|
#include <bitset> |
||||||
|
#include <atomic> |
||||||
|
#include <thread> |
||||||
|
#include <chrono> |
||||||
|
#include <mutex> |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace openim{ |
||||||
|
|
||||||
|
class OpenIMManager |
||||||
|
{ |
||||||
|
private: |
||||||
|
OpenIMManager(){} |
||||||
|
public: |
||||||
|
// instance pattern
|
||||||
|
static OpenIMManager& GetInstance(); |
||||||
|
|
||||||
|
//must be called before use sdk
|
||||||
|
bool InitSDK(const std::function<void(int, const std::string&)>& cCallback,const std::string& operationID,const std::string& config); |
||||||
|
|
||||||
|
void UnInitSDK(const std::string& operationID); |
||||||
|
|
||||||
|
// // set print
|
||||||
|
// void SetPrint(const std::function<void(const std::string&)>& printCallBack);
|
||||||
|
|
||||||
|
// set group listener
|
||||||
|
void SetGroupListener(const std::function<void(int,const std::string&)>& groupListenerCallBack); |
||||||
|
|
||||||
|
// set conversation listener
|
||||||
|
void SetConversationListener(const std::function<void(int, const std::string &)>& conversationListenerCallback); |
||||||
|
|
||||||
|
// set advanced msg listener
|
||||||
|
void SetAdvancedMsgListener(const std::function<void(int, const std::string &)>& advancedMsgListenerCallback); |
||||||
|
|
||||||
|
// set batch msg listener
|
||||||
|
void SetBatchMsgListener(const std::function<void(int, const std::string &)>& batchMsgListenerCallback); |
||||||
|
|
||||||
|
// set user listener
|
||||||
|
void SetUserListener(const std::function<void(int, const std::string &)>& userListenerCallback); |
||||||
|
|
||||||
|
// set friend listener
|
||||||
|
void SetFriendListener(const std::function<void(int, const std::string &)>& friendListenerCallback); |
||||||
|
|
||||||
|
// set custom business listener
|
||||||
|
void SetCustomBusinessListener(const std::function<void(int, const std::string &)>& customBusinessListenerCallback); |
||||||
|
|
||||||
|
// login
|
||||||
|
void Login(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& loginCallback, const std::string& operationID, const std::string& uid, const std::string& token); |
||||||
|
|
||||||
|
// logout
|
||||||
|
void Logout(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& logoutCallback, const std::string& operationID); |
||||||
|
|
||||||
|
// network status changed
|
||||||
|
void NetworkStatusChanged(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& networkStatusCallback, const std::string& operationID); |
||||||
|
|
||||||
|
// get login status
|
||||||
|
GoInt GetLoginStatus(const std::string& operationID); |
||||||
|
|
||||||
|
// get login user
|
||||||
|
std::string GetLoginUser(); |
||||||
|
|
||||||
|
// create text message
|
||||||
|
std::string CreateTextMessage(const std::string& operationID, const std::string& text); |
||||||
|
|
||||||
|
// create advanced text message
|
||||||
|
std::string CreateAdvancedTextMessage(const std::string& operationID, const std::string& text, const std::string& messageEntityList); |
||||||
|
|
||||||
|
// create text at message
|
||||||
|
std::string CreateTextAtMessage(const std::string& operationID, const std::string& text, const std::string& atUserList, const std::string& atUsersInfo, const std::string& message); |
||||||
|
|
||||||
|
// create location message
|
||||||
|
std::string CreateLocationMessage(const std::string& operationID, const std::string& description, double longitude, double latitude); |
||||||
|
|
||||||
|
// create custom message
|
||||||
|
std::string CreateCustomMessage(const std::string& operationID, const std::string& data, const std::string& extension, const std::string& description); |
||||||
|
|
||||||
|
// create quote message
|
||||||
|
std::string CreateQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message); |
||||||
|
|
||||||
|
|
||||||
|
// create advanced quote message
|
||||||
|
std::string CreateAdvancedQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message, const std::string& messageEntityList); |
||||||
|
|
||||||
|
// create card message
|
||||||
|
std::string CreateCardMessage(const std::string& operationID, const std::string& cardInfo); |
||||||
|
|
||||||
|
// create video message from full path
|
||||||
|
std::string CreateVideoMessageFromFullPath(const std::string& operationID, const std::string& videoFullPath, const std::string& videoType, long long int duration, const std::string& snapshotFullPath); |
||||||
|
|
||||||
|
// create image message from full path
|
||||||
|
std::string CreateImageMessageFromFullPath(const std::string& operationID, const std::string& imageFullPath); |
||||||
|
|
||||||
|
// create sound message from full path
|
||||||
|
std::string CreateSoundMessageFromFullPath(const std::string& operationID, const std::string& soundPath, long long int duration); |
||||||
|
|
||||||
|
// create file message from full path
|
||||||
|
std::string CreateFileMessageFromFullPath(const std::string& operationID, const std::string& fileFullPath, const std::string& fileName); |
||||||
|
|
||||||
|
// create image message
|
||||||
|
std::string CreateImageMessage(const std::string& operationID, const std::string& imagePath); |
||||||
|
|
||||||
|
|
||||||
|
// create image message by URL
|
||||||
|
std::string CreateImageMessageByURL(const std::string& operationID, const std::string& sourcePath,const std::string& sourcePicture, const std::string& bigPicture, const std::string& snapshotPicture); |
||||||
|
|
||||||
|
// create sound message by URL
|
||||||
|
std::string CreateSoundMessageByURL(const std::string& operationID, const std::string& soundBaseInfo); |
||||||
|
|
||||||
|
// create sound message
|
||||||
|
std::string CreateSoundMessage(const std::string& operationID, const std::string& soundPath, long long int duration); |
||||||
|
|
||||||
|
// create video message by URL
|
||||||
|
std::string CreateVideoMessageByURL(const std::string& operationID, const std::string& videoBaseInfo); |
||||||
|
|
||||||
|
// create video message
|
||||||
|
std::string CreateVideoMessage(const std::string& operationID, const std::string& videoPath, const std::string& videoType, long long int duration, const std::string& snapshotPath); |
||||||
|
|
||||||
|
// create file message by URL
|
||||||
|
std::string CreateFileMessageByURL(const std::string& operationID, const std::string& fileBaseInfo); |
||||||
|
|
||||||
|
// create file message
|
||||||
|
std::string CreateFileMessage(const std::string& operationID, const std::string& filePath, const std::string& fileName); |
||||||
|
|
||||||
|
// create merger message
|
||||||
|
std::string CreateMergerMessage(const std::string& operationID, const std::string& messageList, const std::string& title, const std::string& summaryList); |
||||||
|
|
||||||
|
// create face message
|
||||||
|
std::string CreateFaceMessage(const std::string& operationID, int index, const std::string& data); |
||||||
|
|
||||||
|
// create forward message
|
||||||
|
std::string CreateForwardMessage(const std::string& operationID, const std::string& m); |
||||||
|
|
||||||
|
// get all conversation list
|
||||||
|
void GetAllConversationList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& getAllConversationListCallback, const std::string& operationID); |
||||||
|
|
||||||
|
// get advanced history message list
|
||||||
|
void GetAdvancedHistoryMessageList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& getAdvancedHistoryCallback , const std::string& operationID, const std::string& getMessageOptions); |
||||||
|
|
||||||
|
// send message
|
||||||
|
void SendMessage(const std::function<void(const std::string&, int, const std::string&, const std::string&, int)>& callback, const std::string& operationID, |
||||||
|
const std::string& message, const std::string& recvID, const std::string& groupID, const std::string& offlinePushInfo,bool isOnlineOnly); |
||||||
|
|
||||||
|
// // =====================================================user===============================================
|
||||||
|
// //
|
||||||
|
|
||||||
|
// get users info
|
||||||
|
void GetUsersInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs); |
||||||
|
|
||||||
|
// get users info from server
|
||||||
|
void GetUsersInfoFromServer(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs); |
||||||
|
|
||||||
|
// set self info
|
||||||
|
void SetSelfInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userInfo); |
||||||
|
|
||||||
|
// get self user info
|
||||||
|
void GetSelfUserInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// update message sender info
|
||||||
|
void UpdateMessageSenderInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& nickname, const std::string& faceURL); |
||||||
|
|
||||||
|
// subscribe users status
|
||||||
|
void SubscribeUsersStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs); |
||||||
|
|
||||||
|
|
||||||
|
// unsubscribe users status
|
||||||
|
void UnsubscribeUsersStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs); |
||||||
|
|
||||||
|
// get subscribe users status
|
||||||
|
void GetSubscribeUsersStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// get user status
|
||||||
|
void GetUserStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs); |
||||||
|
|
||||||
|
// // =====================================================friend===============================================
|
||||||
|
// //
|
||||||
|
|
||||||
|
// get specified friends info
|
||||||
|
void GetSpecifiedFriendsInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs); |
||||||
|
|
||||||
|
// get friend list
|
||||||
|
void GetFriendList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// get friend list page
|
||||||
|
void GetFriendListPage(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, int offset, int count); |
||||||
|
|
||||||
|
// search friends
|
||||||
|
void SearchFriends(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& searchParam); |
||||||
|
|
||||||
|
// check friend
|
||||||
|
void CheckFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs); |
||||||
|
|
||||||
|
// add friend
|
||||||
|
void AddFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDReqMsg); |
||||||
|
|
||||||
|
// set friend remark
|
||||||
|
void SetFriendRemark(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDRemark); |
||||||
|
|
||||||
|
// delete friend
|
||||||
|
void DeleteFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& friendUserID); |
||||||
|
|
||||||
|
// get friend application list as recipient
|
||||||
|
void GetFriendApplicationListAsRecipant(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// get friend application list as applicant
|
||||||
|
void GetFriendApplicationListAsApplicant(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// accept friend application
|
||||||
|
void AcceptFriendApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDHandleMsg); |
||||||
|
|
||||||
|
// refuse friend application
|
||||||
|
void RefuseFriendApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDHandleMsg); |
||||||
|
|
||||||
|
// add black
|
||||||
|
void AddBlack(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& blackUserID); |
||||||
|
|
||||||
|
// get black list
|
||||||
|
void GetBlackList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// remove black
|
||||||
|
void RemoveBlack(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& removeUserID); |
||||||
|
|
||||||
|
// set friends ex
|
||||||
|
void SetFriendsEx(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, |
||||||
|
const std::string& operationID, const std::string& friendIDs,const std::string& ex); |
||||||
|
|
||||||
|
|
||||||
|
// // =====================================================group===============================================
|
||||||
|
// //
|
||||||
|
|
||||||
|
// create group
|
||||||
|
void CreateGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupReqInfo); |
||||||
|
|
||||||
|
// join group
|
||||||
|
void JoinGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& reqMsg, int joinSource,const std::string& ex); |
||||||
|
|
||||||
|
// quit group
|
||||||
|
void QuitGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID); |
||||||
|
|
||||||
|
// dismiss group
|
||||||
|
void DismissGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID); |
||||||
|
|
||||||
|
// change group mute
|
||||||
|
void ChangeGroupMute(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, bool isMute); |
||||||
|
|
||||||
|
// change group member mute
|
||||||
|
void ChangeGroupMemberMute(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, int mutedSeconds); |
||||||
|
|
||||||
|
// SetGroupMemberRoleLevel sets the role level of a group member
|
||||||
|
void SetGroupMemberRoleLevel(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, int roleLevel); |
||||||
|
|
||||||
|
// SetGroupMemberInfo sets the information of a group member
|
||||||
|
void SetGroupMemberInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupMemberInfo); |
||||||
|
|
||||||
|
// GetJoinedGroupList retrieves the list of joined groups
|
||||||
|
void GetJoinedGroupList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// GetSpecifiedGroupsInfo retrieves the information of specified groups
|
||||||
|
void GetSpecifiedGroupsInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupIDList); |
||||||
|
|
||||||
|
// SearchGroups searches for groups
|
||||||
|
void SearchGroups(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& searchParam); |
||||||
|
|
||||||
|
// SetGroupInfo sets the information of a group
|
||||||
|
void SetGroupInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupInfo); |
||||||
|
|
||||||
|
// SetGroupVerification sets the verification mode of a group
|
||||||
|
void SetGroupVerification(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, int verification); |
||||||
|
|
||||||
|
|
||||||
|
// SetGroupLookMemberInfo sets the member information visibility of a group
|
||||||
|
void SetGroupLookMemberInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, int rule); |
||||||
|
|
||||||
|
// SetGroupApplyMemberFriend sets the friend rule for group applicants
|
||||||
|
void SetGroupApplyMemberFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, int rule); |
||||||
|
|
||||||
|
// GetGroupMemberList retrieves the list of group members
|
||||||
|
void GetGroupMemberList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, int filter, int offset, int count); |
||||||
|
|
||||||
|
// GetGroupMemberOwnerAndAdmin retrieves the owner and admin members of a group
|
||||||
|
void GetGroupMemberOwnerAndAdmin(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID); |
||||||
|
|
||||||
|
// GetGroupMemberListByJoinTimeFilter retrieves the list of group members filtered by join time
|
||||||
|
void GetGroupMemberListByJoinTimeFilter(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, int offset, int count, long long int joinTimeBegin, long long int joinTimeEnd, const std::string& filteruserIDs); |
||||||
|
|
||||||
|
// GetSpecifiedGroupMembersInfo retrieves the information of specified group members
|
||||||
|
void GetSpecifiedGroupMembersInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& userIDs); |
||||||
|
|
||||||
|
// KickGroupMember kicks group members
|
||||||
|
void KickGroupMember(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs); |
||||||
|
|
||||||
|
// TransferGroupOwner transfers the ownership of a group
|
||||||
|
void TransferGroupOwner(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& newOwnerUserID); |
||||||
|
|
||||||
|
// InviteUserToGroup invites users to a group
|
||||||
|
void InviteUserToGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs); |
||||||
|
|
||||||
|
// GetGroupApplicationListAsRecipient retrieves the group application list as a recipient
|
||||||
|
void GetGroupApplicationListAsRecipient(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// GetGroupApplicationListAsApplicant retrieves the group application list as an applicant
|
||||||
|
void GetGroupApplicationListAsApplicant(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID); |
||||||
|
|
||||||
|
// AcceptGroupApplication accepts a group application
|
||||||
|
void AcceptGroupApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg); |
||||||
|
|
||||||
|
// RefuseGroupApplication refuses a group application
|
||||||
|
void RefuseGroupApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg); |
||||||
|
|
||||||
|
// SetGroupMemberNickname sets the nickname of a group member
|
||||||
|
void SetGroupMemberNickname(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, const std::string& groupMemberNickname); |
||||||
|
|
||||||
|
// SearchGroupMembers searches for group members
|
||||||
|
void SearchGroupMembers(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& searchParam); |
||||||
|
|
||||||
|
// IsJoinGroup checks if the user has joined a group
|
||||||
|
void IsJoinGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,311 @@ |
|||||||
|
/* |
||||||
|
Using C++ template functions and recursion to initialize a function pointer pool, |
||||||
|
combined with lambda expressions, this implementation manages function pointers, |
||||||
|
achieving acquisition and release of pointers.All wrappers are used to convert |
||||||
|
and map C++ functions to C functions, and with the use of indexed locking, |
||||||
|
a thread-safe function pointer pool is implemented.For example, the wrapping |
||||||
|
functions essentially map C++ functions to C functions. When a C function callback is triggered, |
||||||
|
the function pointer pool, initialized through template recursion, locates the corresponding C++ function and invokes it. |
||||||
|
*/ |
||||||
|
|
||||||
|
#define MAX_NUM_OF_CB_S 10 |
||||||
|
#define MAX_NUM_OF_CB_I_S 10 |
||||||
|
#define MAX_NUM_OF_CB_S_I_S_S 10 |
||||||
|
#define MAX_NUM_OF_CB_S_I_S_S_I 10 |
||||||
|
#define SLEEP_TIME_FOR_GET_INDEX 100 //ms |
||||||
|
|
||||||
|
// use recursive template to generate enough function pointer array |
||||||
|
// and define c type function interface |
||||||
|
// and define manager class to manage function pool |
||||||
|
namespace { |
||||||
|
CB_S* _fps_cb_s=new CB_S[MAX_NUM_OF_CB_S]; |
||||||
|
CB_I_S* _fps_cb_i_s=new CB_I_S[MAX_NUM_OF_CB_I_S]; |
||||||
|
CB_S_I_S_S* _fps_cb_s_i_s_s=new CB_S_I_S_S[MAX_NUM_OF_CB_S_I_S_S]; |
||||||
|
CB_S_I_S_S_I* _fps_cb_s_i_s_s_i=new CB_S_I_S_S_I[MAX_NUM_OF_CB_S_I_S_S_I]; |
||||||
|
// c type func interface call cpp function |
||||||
|
std::function<void(const std::string&)>* _cpp_function_cb_s=new std::function<void(const std::string&)>[MAX_NUM_OF_CB_S]; |
||||||
|
std::function<void(int,const std::string&)>* _cpp_function_cb_i_s=new std::function<void(int,const std::string&)>[MAX_NUM_OF_CB_I_S]; |
||||||
|
std::function<void(const std::string&,int,const std::string&,const std::string&)>* _cpp_function_cb_s_i_s_s=new std::function<void(const std::string&,int,const std::string&,const std::string&)>[MAX_NUM_OF_CB_S_I_S_S]; |
||||||
|
std::function<void(const std::string&,int,const std::string&,const std::string&,int)>* _cpp_function_cb_s_i_s_s_i=new std::function<void(const std::string&,int,const std::string&,const std::string&,int)>[MAX_NUM_OF_CB_S_I_S_S_I]; |
||||||
|
|
||||||
|
template<int N> |
||||||
|
void _generate_cb_s(){ |
||||||
|
_fps_cb_s[N]=[](char* c_str){ |
||||||
|
_cpp_function_cb_s[N](std::string(c_str)); |
||||||
|
}; |
||||||
|
_generate_cb_s<N-1>(); |
||||||
|
} |
||||||
|
template<> |
||||||
|
void _generate_cb_s<0>(){ |
||||||
|
_fps_cb_s[0]=[](char* c_str){ |
||||||
|
_cpp_function_cb_s[0](std::string(c_str)); |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
template<int N> |
||||||
|
void _generate_cb_i_s(){ |
||||||
|
_fps_cb_i_s[N]=[](int code,char* c_str){ |
||||||
|
_cpp_function_cb_i_s[N](code,std::string(c_str)); |
||||||
|
}; |
||||||
|
_generate_cb_i_s<N-1>(); |
||||||
|
} |
||||||
|
template<> |
||||||
|
void _generate_cb_i_s<0>(){ |
||||||
|
_fps_cb_i_s[0]=[](int code,char* c_str){ |
||||||
|
_cpp_function_cb_i_s[0](code,std::string(c_str)); |
||||||
|
}; |
||||||
|
} |
||||||
|
template<int N> |
||||||
|
void _generate_cb_s_i_s_s(){ |
||||||
|
_fps_cb_s_i_s_s[N]=[](char* operationID,int code,char* c_str,char* c_str2){ |
||||||
|
_cpp_function_cb_s_i_s_s[N](std::string(operationID),code,std::string(c_str),std::string(c_str2)); |
||||||
|
}; |
||||||
|
_generate_cb_s_i_s_s<N-1>(); |
||||||
|
} |
||||||
|
template<> |
||||||
|
void _generate_cb_s_i_s_s<0>(){ |
||||||
|
_fps_cb_s_i_s_s[0]=[](char* operationID,int code,char* c_str,char* c_str2){ |
||||||
|
_cpp_function_cb_s_i_s_s[0](std::string(operationID),code,std::string(c_str),std::string(c_str2)); |
||||||
|
}; |
||||||
|
} |
||||||
|
template<int N> |
||||||
|
void _generate_cb_s_i_s_s_i(){ |
||||||
|
_fps_cb_s_i_s_s_i[N]=[](char* operationID,int code,char* c_str,char* c_str2,int c_int){ |
||||||
|
_cpp_function_cb_s_i_s_s_i[N](std::string(operationID),code,std::string(c_str),std::string(c_str2),c_int); |
||||||
|
}; |
||||||
|
_generate_cb_s_i_s_s_i<N-1>(); |
||||||
|
} |
||||||
|
template<> |
||||||
|
void _generate_cb_s_i_s_s_i<0>(){ |
||||||
|
_fps_cb_s_i_s_s_i[0]=[](char* operationID,int code,char* c_str,char* c_str2,int c_int){ |
||||||
|
_cpp_function_cb_s_i_s_s_i[0](std::string(operationID),code,std::string(c_str),std::string(c_str2),c_int); |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
// init global function pointer array |
||||||
|
void init(){ |
||||||
|
_generate_cb_s<MAX_NUM_OF_CB_S-1>(); |
||||||
|
_generate_cb_i_s<MAX_NUM_OF_CB_I_S-1>(); |
||||||
|
_generate_cb_s_i_s_s<MAX_NUM_OF_CB_S_I_S_S-1>(); |
||||||
|
_generate_cb_s_i_s_s_i<MAX_NUM_OF_CB_S_I_S_S_I-1>(); |
||||||
|
} |
||||||
|
// define sigle instance class to manage function pool |
||||||
|
class FuncPoolManager{ |
||||||
|
private: |
||||||
|
// define a global bitmap, and support atomic operation, to manage cb_s pool |
||||||
|
std::bitset<MAX_NUM_OF_CB_S> _cb_s_bitmap; |
||||||
|
std::bitset<MAX_NUM_OF_CB_I_S> _cb_i_s_bitmap; |
||||||
|
std::bitset<MAX_NUM_OF_CB_S_I_S_S> _cb_s_i_s_s_bitmap; |
||||||
|
std::bitset<MAX_NUM_OF_CB_S_I_S_S_I> _cb_s_i_s_s_i_bitmap; |
||||||
|
std::mutex _cb_s_mutex; |
||||||
|
std::mutex _cb_i_s_mutex; |
||||||
|
std::mutex _cb_s_i_s_s_mutex; |
||||||
|
std::mutex _cb_s_i_s_s_i_mutex; |
||||||
|
FuncPoolManager(){ |
||||||
|
init(); |
||||||
|
} |
||||||
|
FuncPoolManager(const FuncPoolManager&){} |
||||||
|
public: |
||||||
|
static FuncPoolManager& get_instance(){ |
||||||
|
static FuncPoolManager instance; |
||||||
|
return instance; |
||||||
|
} |
||||||
|
// get a available cb_s function index |
||||||
|
int get_cb_s_index(){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_s_mutex); |
||||||
|
int index=-1; |
||||||
|
for(int i=0;i<_cb_s_bitmap.size();i++){ |
||||||
|
if(_cb_s_bitmap[i]==0){ |
||||||
|
_cb_s_bitmap[i]=1; |
||||||
|
index=i; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return index; |
||||||
|
} |
||||||
|
// get a available cb_i_s function index |
||||||
|
int get_cb_i_s_index(){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_i_s_mutex); |
||||||
|
int index=-1; |
||||||
|
for(int i=0;i<_cb_i_s_bitmap.size();i++){ |
||||||
|
if(_cb_i_s_bitmap[i]==0){ |
||||||
|
_cb_i_s_bitmap[i]=1; |
||||||
|
index=i; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return index; |
||||||
|
} |
||||||
|
// get a available cb_s_i_s_s function index |
||||||
|
int get_cb_s_i_s_s_index(){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_s_i_s_s_mutex); |
||||||
|
int index=-1; |
||||||
|
for(int i=0;i<_cb_s_i_s_s_bitmap.size();i++){ |
||||||
|
if(_cb_s_i_s_s_bitmap[i]==0){ |
||||||
|
_cb_s_i_s_s_bitmap[i]=1; |
||||||
|
index=i; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return index; |
||||||
|
} |
||||||
|
// get a available cb_s_i_s_s_i function index |
||||||
|
int get_cb_s_i_s_s_i_index(){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_s_i_s_s_i_mutex); |
||||||
|
int index=-1; |
||||||
|
for(int i=0;i<_cb_s_i_s_s_i_bitmap.size();i++){ |
||||||
|
if(_cb_s_i_s_s_i_bitmap[i]==0){ |
||||||
|
_cb_s_i_s_s_i_bitmap[i]=1; |
||||||
|
index=i; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return index; |
||||||
|
} |
||||||
|
// release a available cb_s function index |
||||||
|
int release_cb_s_index(int index){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_s_mutex); |
||||||
|
if(index<0||index>=_cb_s_bitmap.size()){ |
||||||
|
return -1; |
||||||
|
} |
||||||
|
_cpp_function_cb_s[index]=nullptr; |
||||||
|
_cb_s_bitmap[index]=0; |
||||||
|
return 0; |
||||||
|
} |
||||||
|
// release a available cb_i_s function index |
||||||
|
int release_cb_i_s_index(int index){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_i_s_mutex); |
||||||
|
if(index<0||index>=_cb_i_s_bitmap.size()){ |
||||||
|
return -1; |
||||||
|
} |
||||||
|
_cpp_function_cb_i_s[index]=nullptr; |
||||||
|
_cb_i_s_bitmap[index]=0; |
||||||
|
return 0; |
||||||
|
} |
||||||
|
// release a available cb_s_i_s_s function index |
||||||
|
int release_cb_s_i_s_s_index(int index){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_s_i_s_s_mutex); |
||||||
|
if(index<0||index>=_cb_s_i_s_s_bitmap.size()){ |
||||||
|
return -1; |
||||||
|
} |
||||||
|
_cpp_function_cb_s_i_s_s[index]=nullptr; |
||||||
|
_cb_s_i_s_s_bitmap[index]=0; |
||||||
|
return 0; |
||||||
|
} |
||||||
|
// release a available cb_s_i_s_s_i function index |
||||||
|
int release_cb_s_i_s_s_i_index(int index){ |
||||||
|
std::lock_guard<std::mutex> lock(_cb_s_i_s_s_i_mutex); |
||||||
|
if(index<0||index>=_cb_s_i_s_s_i_bitmap.size()){ |
||||||
|
return -1; |
||||||
|
} |
||||||
|
_cpp_function_cb_s_i_s_s_i[index]=nullptr; |
||||||
|
_cb_s_i_s_s_i_bitmap[index]=0; |
||||||
|
return 0; |
||||||
|
} |
||||||
|
}; |
||||||
|
FuncPoolManager& instance=FuncPoolManager::get_instance(); |
||||||
|
|
||||||
|
// wrapper persistent function |
||||||
|
// wrapp CB_S,if function pool is full,return nullptr |
||||||
|
CB_S _wrapper_cpp_function(const std::function<void(const std::string&)>& cpp_function) { |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_s_index(); |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_s_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_s[index]=cpp_function; |
||||||
|
return _fps_cb_s[index]; |
||||||
|
} |
||||||
|
// wrapp CB_I_S |
||||||
|
CB_I_S _wrapper_cpp_function(const std::function<void(int,const std::string&)>& cpp_function) |
||||||
|
{ |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_i_s_index(); |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_i_s_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_i_s[index]=cpp_function; |
||||||
|
return _fps_cb_i_s[index]; |
||||||
|
} |
||||||
|
// wrapp CB_S_I_S_S |
||||||
|
CB_S_I_S_S _wrapper_cpp_function(const std::function<void(const std::string&,int,const std::string&,const std::string&)>& cpp_function) |
||||||
|
{ |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_s_i_s_s[index]=cpp_function; |
||||||
|
return _fps_cb_s_i_s_s[index]; |
||||||
|
} |
||||||
|
// wrapp CB_S_I_S_S_I |
||||||
|
CB_S_I_S_S_I _wrapper_cpp_function(const std::function<void(const std::string&,int,const std::string&,const std::string&,int)>& cpp_function) |
||||||
|
{ |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_s_i_s_s_i[index]=cpp_function; |
||||||
|
return _fps_cb_s_i_s_s_i[index]; |
||||||
|
} |
||||||
|
|
||||||
|
// wrapp function to onetime function |
||||||
|
CB_S _wrapper_callonce_cpp_function(const std::function<void(const std::string&)>& cpp_function) { |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_s_index(); |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_s_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_s[index]=[cpp_function,index](const std::string& str)->void { |
||||||
|
cpp_function(str); |
||||||
|
FuncPoolManager::get_instance().release_cb_s_index(index); |
||||||
|
}; |
||||||
|
return _fps_cb_s[index]; |
||||||
|
} |
||||||
|
|
||||||
|
CB_I_S _wrapper_callonce_cpp_function(const std::function<void(int,const std::string&)>& cpp_function) |
||||||
|
{ |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_i_s_index(); |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_i_s_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_i_s[index]=[cpp_function,index](int code,const std::string& str)->void { |
||||||
|
cpp_function(code,str); |
||||||
|
FuncPoolManager::get_instance().release_cb_i_s_index(index); |
||||||
|
}; |
||||||
|
return _fps_cb_i_s[index]; |
||||||
|
} |
||||||
|
|
||||||
|
CB_S_I_S_S _wrapper_callonce_cpp_function(const std::function<void(const std::string&,int,const std::string&,const std::string&)>& cpp_function) |
||||||
|
{ |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_s_i_s_s[index]=[cpp_function,index](const std::string& operationID,int code,const std::string& str,const std::string& str2)->void { |
||||||
|
cpp_function(operationID,code,str,str2); |
||||||
|
FuncPoolManager::get_instance().release_cb_s_i_s_s_index(index); |
||||||
|
}; |
||||||
|
return _fps_cb_s_i_s_s[index]; |
||||||
|
} |
||||||
|
|
||||||
|
CB_S_I_S_S_I _wrapper_callonce_cpp_function(const std::function<void(const std::string&,int,const std::string&,const std::string&,int)>& cpp_function) |
||||||
|
{ |
||||||
|
int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); |
||||||
|
// while loop util get a available index |
||||||
|
while(index<0){ |
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); |
||||||
|
index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); |
||||||
|
} |
||||||
|
_cpp_function_cb_s_i_s_s_i[index]=[cpp_function,index](const std::string& operationID,int code,const std::string& str,const std::string& str2,int c_int)->void { |
||||||
|
cpp_function(operationID,code,str,str2,c_int); |
||||||
|
FuncPoolManager::get_instance().release_cb_s_i_s_s_i_index(index); |
||||||
|
}; |
||||||
|
return _fps_cb_s_i_s_s_i[index]; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,881 @@ |
|||||||
|
#include "../include/libopenimsdk.h" |
||||||
|
|
||||||
|
#include "../include/wrapp_cpp_function.inc" |
||||||
|
|
||||||
|
namespace openim { |
||||||
|
|
||||||
|
// // ===================================================== init ===============================================
|
||||||
|
// must be called before use sdk
|
||||||
|
|
||||||
|
// instance pattern
|
||||||
|
OpenIMManager& OpenIMManager::GetInstance() |
||||||
|
{ |
||||||
|
static OpenIMManager instance; |
||||||
|
return instance; |
||||||
|
} |
||||||
|
|
||||||
|
// must be called before use sdk
|
||||||
|
bool OpenIMManager::InitSDK(const std::function<void(int,const std::string&)>& cCallback, const std::string &operationID, const std::string &config) |
||||||
|
{ |
||||||
|
char *operationID_cs = const_cast<char *>(operationID.c_str()); |
||||||
|
char *config_cs = const_cast<char *>(config.c_str()); |
||||||
|
int ret=init_sdk(_wrapper_cpp_function(cCallback), operationID_cs, config_cs); |
||||||
|
return (ret&1)==1; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// release resouces used by SDK
|
||||||
|
void OpenIMManager::UnInitSDK(const std::string &operationID) |
||||||
|
{ |
||||||
|
// TODO: free all functions in function pool
|
||||||
|
|
||||||
|
char *operationID_cs = const_cast<char *>(operationID.c_str()); |
||||||
|
return un_init_sdk(operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// // ===================================================== set listener ===============================================
|
||||||
|
// impl for set listener, this callback function will be keep in memory,until call SetXXXListener again
|
||||||
|
|
||||||
|
// for debug
|
||||||
|
// void OpenIMManager::SetPrint(const std::function<void(const std::string&)>& printCallBack)
|
||||||
|
// {
|
||||||
|
// this->printCallBack = _wrapper_cpp_function(printCallBack);
|
||||||
|
// set_print((CB_S)((this->printCallBack).target<void(*)(const std::string&)>()));
|
||||||
|
// }
|
||||||
|
|
||||||
|
void OpenIMManager::SetAdvancedMsgListener(const std::function<void(int, const std::string &)>& advancedMsgListenerCallback) |
||||||
|
{ |
||||||
|
set_advanced_msg_listener(_wrapper_cpp_function(advancedMsgListenerCallback)); |
||||||
|
} |
||||||
|
void OpenIMManager::SetBatchMsgListener(const std::function<void(int, const std::string &)>& batchMsgListenerCallback) |
||||||
|
{ |
||||||
|
set_batch_msg_listener(_wrapper_cpp_function(batchMsgListenerCallback)); |
||||||
|
} |
||||||
|
void OpenIMManager::SetConversationListener(const std::function<void(int, const std::string &)>& conversationListenerCallback) |
||||||
|
{ |
||||||
|
set_conversation_listener(_wrapper_cpp_function(conversationListenerCallback)); |
||||||
|
} |
||||||
|
void OpenIMManager::SetCustomBusinessListener(const std::function<void(int, const std::string &)>& customBusinessListenerCallback) |
||||||
|
{ |
||||||
|
set_custom_business_listener(_wrapper_cpp_function(customBusinessListenerCallback)); |
||||||
|
} |
||||||
|
void OpenIMManager::SetFriendListener(const std::function<void(int, const std::string &)>& friendListenerCallback) |
||||||
|
{ |
||||||
|
set_friend_listener(_wrapper_cpp_function(friendListenerCallback)); |
||||||
|
} |
||||||
|
void OpenIMManager::SetGroupListener(const std::function<void(int, const std::string &)>& groupListenerCallback) |
||||||
|
{ |
||||||
|
set_group_listener(_wrapper_cpp_function(groupListenerCallback)); |
||||||
|
} |
||||||
|
void OpenIMManager::SetUserListener(const std::function<void(int, const std::string &)>& userListenerCallback) |
||||||
|
{ |
||||||
|
set_user_listener(_wrapper_cpp_function(userListenerCallback)); |
||||||
|
} |
||||||
|
|
||||||
|
// // ===================================================== CallOnce Callback ===============================================
|
||||||
|
// callback function arg below will be free after call once, so we need to wrapp it to onetime
|
||||||
|
// // ===================================================== message ===============================================
|
||||||
|
|
||||||
|
// // ===================================================== login logout ===============================================
|
||||||
|
void OpenIMManager::Login(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& loginCallback, const std::string& operationID, const std::string& uid, const std::string& token) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* uid_cs=const_cast<char*>(uid.c_str()); |
||||||
|
char* token_cs=const_cast<char*>(token.c_str()); |
||||||
|
login(_wrapper_callonce_cpp_function(loginCallback),operationID_cs,uid_cs,token_cs); |
||||||
|
} |
||||||
|
|
||||||
|
void OpenIMManager::Logout(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& logoutCallback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
logout(_wrapper_callonce_cpp_function(logoutCallback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
GoInt OpenIMManager::GetLoginStatus(const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
return get_login_status(operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
std::string OpenIMManager::GetLoginUser() |
||||||
|
{ |
||||||
|
char* user=get_login_user(); |
||||||
|
std::string user_str(user); |
||||||
|
free(user); |
||||||
|
return get_login_user(); |
||||||
|
} |
||||||
|
|
||||||
|
void OpenIMManager::NetworkStatusChanged(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& networkStatusCallback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
network_status_changed(_wrapper_callonce_cpp_function(networkStatusCallback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// // ===================================================== message ===============================================
|
||||||
|
// //
|
||||||
|
|
||||||
|
// create text message
|
||||||
|
std::string OpenIMManager::CreateTextMessage(const std::string& operationID, const std::string& text) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* text_cs=const_cast<char*>(text.c_str()); |
||||||
|
char* result_cs=create_text_message(operationID_cs,text_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
// release dynamic c string memory
|
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create advanced text message
|
||||||
|
std::string OpenIMManager::CreateAdvancedTextMessage(const std::string& operationID, const std::string& text, const std::string& messageEntityList) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* text_cs=const_cast<char*>(text.c_str()); |
||||||
|
char* messageEntityList_cs=const_cast<char*>(messageEntityList.c_str()); |
||||||
|
char* result_cs=create_advanced_text_message(operationID_cs,text_cs,messageEntityList_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create text at message
|
||||||
|
std::string OpenIMManager::CreateTextAtMessage(const std::string& operationID, const std::string& text, const std::string& atUserList, const std::string& atUsersInfo, const std::string& message) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* text_cs=const_cast<char*>(text.c_str()); |
||||||
|
char* atUserList_cs=const_cast<char*>(atUserList.c_str()); |
||||||
|
char* atUsersInfo_cs=const_cast<char*>(atUsersInfo.c_str()); |
||||||
|
char* message_cs=const_cast<char*>(message.c_str()); |
||||||
|
char* result_cs=create_text_at_message(operationID_cs,text_cs,atUserList_cs,atUsersInfo_cs,message_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create location message
|
||||||
|
std::string OpenIMManager::CreateLocationMessage(const std::string& operationID, const std::string& description, double longitude, double latitude) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* description_cs=const_cast<char*>(description.c_str()); |
||||||
|
char* result_cs=create_location_message(operationID_cs,description_cs,longitude,latitude); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create custom message
|
||||||
|
std::string OpenIMManager::CreateCustomMessage(const std::string& operationID, const std::string& data, const std::string& extension, const std::string& description) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* data_cs=const_cast<char*>(data.c_str()); |
||||||
|
char* extension_cs=const_cast<char*>(extension.c_str()); |
||||||
|
char* description_cs=const_cast<char*>(description.c_str()); |
||||||
|
char* result_cs=create_custom_message(operationID_cs,data_cs,extension_cs,description_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create quote message
|
||||||
|
std::string OpenIMManager::CreateQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* text_cs=const_cast<char*>(text.c_str()); |
||||||
|
char* message_cs=const_cast<char*>(message.c_str()); |
||||||
|
char* result_cs=create_quote_message(operationID_cs,text_cs,message_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// create advanced quote message
|
||||||
|
std::string OpenIMManager::CreateAdvancedQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message, const std::string& messageEntityList) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* text_cs=const_cast<char*>(text.c_str()); |
||||||
|
char* message_cs=const_cast<char*>(message.c_str()); |
||||||
|
char* messageEntityList_cs=const_cast<char*>(messageEntityList.c_str()); |
||||||
|
char* result_cs=create_advanced_quote_message(operationID_cs,text_cs,message_cs,messageEntityList_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create card message
|
||||||
|
std::string OpenIMManager::CreateCardMessage(const std::string& operationID, const std::string& cardInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* cardInfo_cs=const_cast<char*>(cardInfo.c_str()); |
||||||
|
char* result_cs=create_card_message(operationID_cs,cardInfo_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create video message from full path
|
||||||
|
std::string OpenIMManager::CreateVideoMessageFromFullPath(const std::string& operationID, const std::string& videoFullPath, const std::string& videoType, long long int duration, const std::string& snapshotFullPath) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* videoFullPath_cs=const_cast<char*>(videoFullPath.c_str()); |
||||||
|
char* videoType_cs=const_cast<char*>(videoType.c_str()); |
||||||
|
char* snapshotFullPath_cs=const_cast<char*>(snapshotFullPath.c_str()); |
||||||
|
char* result_cs=create_video_message_from_full_path(operationID_cs,videoFullPath_cs,videoType_cs,duration,snapshotFullPath_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create image message from full path
|
||||||
|
std::string OpenIMManager::CreateImageMessageFromFullPath(const std::string& operationID, const std::string& imageFullPath) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* imageFullPath_cs=const_cast<char*>(imageFullPath.c_str()); |
||||||
|
char* result_cs=create_image_message_from_full_path(operationID_cs,imageFullPath_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create sound message from full path
|
||||||
|
std::string OpenIMManager::CreateSoundMessageFromFullPath(const std::string& operationID, const std::string& soundPath, long long int duration) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* soundPath_cs=const_cast<char*>(soundPath.c_str()); |
||||||
|
char* result_cs=create_sound_message_from_full_path(operationID_cs,soundPath_cs,duration); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create file message from full path
|
||||||
|
std::string OpenIMManager::CreateFileMessageFromFullPath(const std::string& operationID, const std::string& fileFullPath, const std::string& fileName) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* fileFullPath_cs=const_cast<char*>(fileFullPath.c_str()); |
||||||
|
char* fileName_cs=const_cast<char*>(fileName.c_str()); |
||||||
|
char* result_cs=create_file_message_from_full_path(operationID_cs,fileFullPath_cs,fileName_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create image message
|
||||||
|
std::string OpenIMManager::CreateImageMessage(const std::string& operationID, const std::string& imagePath) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* imagePath_cs=const_cast<char*>(imagePath.c_str()); |
||||||
|
char* result_cs=create_image_message(operationID_cs,imagePath_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create image message by URL
|
||||||
|
std::string OpenIMManager::CreateImageMessageByURL(const std::string& operationID,const std::string& sourcePath, const std::string& sourcePicture, const std::string& bigPicture, const std::string& snapshotPicture) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* sourcePath_cs=const_cast<char*>(sourcePath.c_str()); |
||||||
|
char* sourcePicture_cs=const_cast<char*>(sourcePicture.c_str()); |
||||||
|
char* bigPicture_cs=const_cast<char*>(bigPicture.c_str()); |
||||||
|
char* snapshotPicture_cs=const_cast<char*>(snapshotPicture.c_str()); |
||||||
|
char* result_cs=create_image_message_by_url(operationID_cs,sourcePath_cs,sourcePicture_cs,bigPicture_cs,snapshotPicture_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create sound message by URL
|
||||||
|
std::string OpenIMManager::CreateSoundMessageByURL(const std::string& operationID, const std::string& soundBaseInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* soundBaseInfo_cs=const_cast<char*>(soundBaseInfo.c_str()); |
||||||
|
char* result_cs=create_sound_message_by_url(operationID_cs,soundBaseInfo_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create sound message
|
||||||
|
std::string OpenIMManager::CreateSoundMessage(const std::string& operationID, const std::string& soundPath, long long int duration) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* soundPath_cs=const_cast<char*>(soundPath.c_str()); |
||||||
|
char* result_cs=create_sound_message(operationID_cs,soundPath_cs,duration); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create video message by URL
|
||||||
|
std::string OpenIMManager::CreateVideoMessageByURL(const std::string& operationID, const std::string& videoBaseInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* videoBaseInfo_cs=const_cast<char*>(videoBaseInfo.c_str()); |
||||||
|
char* result_cs=create_video_message_by_url(operationID_cs,videoBaseInfo_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create video message
|
||||||
|
std::string OpenIMManager::CreateVideoMessage(const std::string& operationID, const std::string& videoPath, const std::string& videoType, long long int duration, const std::string& snapshotPath) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* videoPath_cs=const_cast<char*>(videoPath.c_str()); |
||||||
|
char* videoType_cs=const_cast<char*>(videoType.c_str()); |
||||||
|
char* snapshotPath_cs=const_cast<char*>(snapshotPath.c_str()); |
||||||
|
char* result_cs=create_video_message(operationID_cs,videoPath_cs,videoType_cs,duration,snapshotPath_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create file message by URL
|
||||||
|
std::string OpenIMManager::CreateFileMessageByURL(const std::string& operationID, const std::string& fileBaseInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* fileBaseInfo_cs=const_cast<char*>(fileBaseInfo.c_str()); |
||||||
|
char* result_cs=create_file_message_by_url(operationID_cs,fileBaseInfo_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create file message
|
||||||
|
std::string OpenIMManager::CreateFileMessage(const std::string& operationID, const std::string& filePath, const std::string& fileName) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* filePath_cs=const_cast<char*>(filePath.c_str()); |
||||||
|
char* fileName_cs=const_cast<char*>(fileName.c_str()); |
||||||
|
char* result_cs=create_file_message(operationID_cs,filePath_cs,fileName_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create merger message
|
||||||
|
std::string OpenIMManager::CreateMergerMessage(const std::string& operationID, const std::string& messageList, const std::string& title, const std::string& summaryList) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* messageList_cs=const_cast<char*>(messageList.c_str()); |
||||||
|
char* title_cs=const_cast<char*>(title.c_str()); |
||||||
|
char* summaryList_cs=const_cast<char*>(summaryList.c_str()); |
||||||
|
char* result_cs=create_merger_message(operationID_cs,messageList_cs,title_cs,summaryList_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create face message
|
||||||
|
std::string OpenIMManager::CreateFaceMessage(const std::string& operationID, int index, const std::string& data) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* data_cs=const_cast<char*>(data.c_str()); |
||||||
|
char* result_cs=create_face_message(operationID_cs,index,data_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// create forward message
|
||||||
|
std::string OpenIMManager::CreateForwardMessage(const std::string& operationID, const std::string& m) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* m_cs=const_cast<char*>(m.c_str()); |
||||||
|
char* result_cs=create_forward_message(operationID_cs,m_cs); |
||||||
|
std::string result(result_cs); |
||||||
|
free(result_cs); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
// get all conversation list
|
||||||
|
void OpenIMManager::GetAllConversationList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& getAllConversationListCallback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_all_conversation_list(_wrapper_callonce_cpp_function(getAllConversationListCallback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get advanced history message list
|
||||||
|
void OpenIMManager::GetAdvancedHistoryMessageList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& getAdvancedHistoryCallback , const std::string& operationID, const std::string& getMessageOptions) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* getMessageOptions_cs=const_cast<char*>(getMessageOptions.c_str()); |
||||||
|
get_advanced_history_message_list(_wrapper_callonce_cpp_function(getAdvancedHistoryCallback),operationID_cs,getMessageOptions_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// send message
|
||||||
|
void SendMessage(const std::function<void(const std::string&, int, const std::string&, const std::string&,int)>& sendMessageCallback, |
||||||
|
const std::string& operationID, const std::string& message,const std::string& recvID,const std::string& groupID,const std::string& offlinePushInfo,bool isOnlineOnly) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* message_cs=const_cast<char*>(message.c_str()); |
||||||
|
char* recvID_cs=const_cast<char*>(recvID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* offlinePushInfo_cs=const_cast<char*>(offlinePushInfo.c_str()); |
||||||
|
int isOnlineOnly_c = isOnlineOnly ? 1 : 0; |
||||||
|
send_message(_wrapper_callonce_cpp_function(sendMessageCallback),operationID_cs,message_cs,recvID_cs,groupID_cs,offlinePushInfo_cs,isOnlineOnly_c); |
||||||
|
} |
||||||
|
|
||||||
|
// // ===================================================== user ===============================================
|
||||||
|
// //
|
||||||
|
|
||||||
|
// get users info
|
||||||
|
void OpenIMManager::GetUsersInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
get_users_info(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get users info from server
|
||||||
|
void OpenIMManager::GetUsersInfoFromServer(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID,const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
get_users_info_from_srv(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// set self info
|
||||||
|
void OpenIMManager::SetSelfInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& selfInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* selfInfo_cs=const_cast<char*>(selfInfo.c_str()); |
||||||
|
set_self_info(_wrapper_callonce_cpp_function(callback),operationID_cs,selfInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get self user info
|
||||||
|
void OpenIMManager::GetSelfUserInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_self_user_info(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// update message sender info
|
||||||
|
void OpenIMManager::UpdateMessageSenderInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& nickname,const std::string& faceURL) |
||||||
|
{ |
||||||
|
//TODO
|
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* nickname_cs=const_cast<char*>(nickname.c_str()); |
||||||
|
char* faceURL_cs=const_cast<char*>(faceURL.c_str()); |
||||||
|
update_msg_sender_info(_wrapper_callonce_cpp_function(callback),operationID_cs,nickname_cs,faceURL_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// subscribe users status
|
||||||
|
void OpenIMManager::SubscribeUsersStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
subscribe_users_status(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// unsubscribe users status
|
||||||
|
void OpenIMManager::UnsubscribeUsersStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
unsubscribe_users_status(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get subscribe users status
|
||||||
|
void OpenIMManager::GetSubscribeUsersStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_subscribe_users_status(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get user status
|
||||||
|
void OpenIMManager::GetUserStatus(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& userID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userID_cs=const_cast<char*>(userID.c_str()); |
||||||
|
get_user_status(_wrapper_callonce_cpp_function(callback),operationID_cs,userID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// // ===================================================== friend ===============================================
|
||||||
|
// //
|
||||||
|
|
||||||
|
// get specified friends info
|
||||||
|
void OpenIMManager::GetSpecifiedFriendsInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
get_specified_friends_info(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get friend list
|
||||||
|
void OpenIMManager::GetFriendList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_friend_list(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get friend list page
|
||||||
|
void OpenIMManager::GetFriendListPage(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, int offset, int count) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_friend_list_page(_wrapper_callonce_cpp_function(callback),operationID_cs,offset,count); |
||||||
|
} |
||||||
|
|
||||||
|
// search friends
|
||||||
|
void OpenIMManager::SearchFriends(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& searchParam) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* searchParam_cs=const_cast<char*>(searchParam.c_str()); |
||||||
|
search_friends(_wrapper_callonce_cpp_function(callback),operationID_cs,searchParam_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// check friend
|
||||||
|
void OpenIMManager::CheckFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& userID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userID_cs=const_cast<char*>(userID.c_str()); |
||||||
|
check_friend(_wrapper_callonce_cpp_function(callback),operationID_cs,userID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// add friend
|
||||||
|
void OpenIMManager::AddFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& friendInfo, const std::string& addFriendExtraInfo) |
||||||
|
{ |
||||||
|
char* friendInfo_cs=const_cast<char*>(friendInfo.c_str()); |
||||||
|
char* addFriendExtraInfo_cs=const_cast<char*>(addFriendExtraInfo.c_str()); |
||||||
|
add_friend(_wrapper_callonce_cpp_function(callback),friendInfo_cs,addFriendExtraInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// set friend remark
|
||||||
|
void OpenIMManager::SetFriendRemark(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& userID, const std::string& remark) |
||||||
|
{ |
||||||
|
char* userID_cs=const_cast<char*>(userID.c_str()); |
||||||
|
char* remark_cs=const_cast<char*>(remark.c_str()); |
||||||
|
set_friend_remark(_wrapper_callonce_cpp_function(callback),userID_cs,remark_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// delete friend
|
||||||
|
void OpenIMManager::DeleteFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& userID, const std::string& deleteFriendExtraInfo) |
||||||
|
{ |
||||||
|
char* userID_cs=const_cast<char*>(userID.c_str()); |
||||||
|
char* deleteFriendExtraInfo_cs=const_cast<char*>(deleteFriendExtraInfo.c_str()); |
||||||
|
delete_friend(_wrapper_callonce_cpp_function(callback),userID_cs,deleteFriendExtraInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get friend application list as recipant
|
||||||
|
void OpenIMManager::GetFriendApplicationListAsRecipant(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_friend_application_list_as_recipient(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get friend application list as applicant
|
||||||
|
void OpenIMManager::GetFriendApplicationListAsApplicant(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_friend_application_list_as_applicant(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// accept friend application
|
||||||
|
void OpenIMManager::AcceptFriendApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& friendApplicationID, const std::string& extraInfo) |
||||||
|
{ |
||||||
|
char* friendApplicationID_cs=const_cast<char*>(friendApplicationID.c_str()); |
||||||
|
char* extraInfo_cs=const_cast<char*>(extraInfo.c_str()); |
||||||
|
accept_friend_application(_wrapper_callonce_cpp_function(callback),friendApplicationID_cs,extraInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// refuse friend application
|
||||||
|
void OpenIMManager::RefuseFriendApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& friendApplicationID, const std::string& extraInfo) |
||||||
|
{ |
||||||
|
char* friendApplicationID_cs=const_cast<char*>(friendApplicationID.c_str()); |
||||||
|
char* extraInfo_cs=const_cast<char*>(extraInfo.c_str()); |
||||||
|
refuse_friend_application(_wrapper_callonce_cpp_function(callback),friendApplicationID_cs,extraInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// add black
|
||||||
|
void OpenIMManager::AddBlack(const std::function<void(const std::string&, int, const std::string&, |
||||||
|
const std::string&)>& callback,const std::string& operationID, const std::string& userIDs,const std::string& ex) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
char* ex_cs = const_cast<char*>(ex.c_str()); |
||||||
|
add_black(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs,ex_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get black list
|
||||||
|
void OpenIMManager::GetBlackList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_black_list(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// remove black
|
||||||
|
void OpenIMManager::RemoveBlack(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
remove_black(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// set friends ex
|
||||||
|
void OpenIMManager::SetFriendsEx(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID,const std::string& friendIDs, const std::string& ex) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* friendIDs_cs=const_cast<char*>(friendIDs.c_str()); |
||||||
|
char* ex_cs=const_cast<char*>(ex.c_str()); |
||||||
|
set_friends_ex(_wrapper_callonce_cpp_function(callback),operationID_cs,friendIDs_cs,ex_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// // ===================================================== group ===============================================
|
||||||
|
// //
|
||||||
|
|
||||||
|
// create group
|
||||||
|
void OpenIMManager::CreateGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupReqInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupReqInfo_cs=const_cast<char*>(groupReqInfo.c_str()); |
||||||
|
create_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupReqInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// join group
|
||||||
|
void OpenIMManager::JoinGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, |
||||||
|
const std::string& operationID, const std::string& groupID, const std::string& reqMsg, int joinSource,const std::string& ex) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* reqMsg_cs=const_cast<char*>(reqMsg.c_str()); |
||||||
|
char* ex_cs = const_cast<char*>(ex.c_str()); |
||||||
|
join_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,reqMsg_cs,joinSource,ex_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// quit group
|
||||||
|
void OpenIMManager::QuitGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& groupID, const std::string& reqMsg) |
||||||
|
{ |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* reqMsg_cs=const_cast<char*>(reqMsg.c_str()); |
||||||
|
quit_group(_wrapper_callonce_cpp_function(callback),groupID_cs,reqMsg_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// dismiss group
|
||||||
|
void OpenIMManager::DismissGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& groupID, const std::string& reqMsg) |
||||||
|
{ |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* reqMsg_cs=const_cast<char*>(reqMsg.c_str()); |
||||||
|
dismiss_group(_wrapper_callonce_cpp_function(callback),groupID_cs,reqMsg_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// change group mute
|
||||||
|
void OpenIMManager::ChangeGroupMute(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID, bool mute) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
change_group_mute(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,mute); |
||||||
|
} |
||||||
|
|
||||||
|
// change group member mute
|
||||||
|
void OpenIMManager::ChangeGroupMemberMute(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID, const std::string& memberID, int mutedSeconds) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* memberID_cs=const_cast<char*>(memberID.c_str()); |
||||||
|
change_group_member_mute(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,memberID_cs,mutedSeconds); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// set the role level of a group member
|
||||||
|
void OpenIMManager::SetGroupMemberRoleLevel(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID, const std::string& memberID, int roleLevel) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* memberID_cs=const_cast<char*>(memberID.c_str()); |
||||||
|
set_group_member_role_level(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,memberID_cs,roleLevel); |
||||||
|
} |
||||||
|
|
||||||
|
// set the information of a group member
|
||||||
|
void OpenIMManager::SetGroupMemberInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupMemberInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupMemberInfo_cs=const_cast<char*>(groupMemberInfo.c_str()); |
||||||
|
set_group_member_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupMemberInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get Joined Group List
|
||||||
|
void OpenIMManager::GetJoinedGroupList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_joined_group_list(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get specified groups info
|
||||||
|
void OpenIMManager::GetSpecifiedGroupsInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupIDList) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupIDList_cs=const_cast<char*>(groupIDList.c_str()); |
||||||
|
get_specified_groups_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupIDList_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// search groups
|
||||||
|
void OpenIMManager::SearchGroups(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& searchParam) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* searchParam_cs=const_cast<char*>(searchParam.c_str()); |
||||||
|
search_groups(_wrapper_callonce_cpp_function(callback),operationID_cs,searchParam_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// set group info
|
||||||
|
void OpenIMManager::SetGroupInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupInfo_cs=const_cast<char*>(groupInfo.c_str()); |
||||||
|
set_group_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupInfo_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// set group verification
|
||||||
|
void OpenIMManager::SetGroupVerification(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID, int verification) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
set_group_verification(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,verification); |
||||||
|
} |
||||||
|
|
||||||
|
// set group look member info
|
||||||
|
void OpenIMManager::SetGroupLookMemberInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID, int lookInfo) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
set_group_look_member_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,lookInfo); |
||||||
|
} |
||||||
|
|
||||||
|
// set group apply member friend
|
||||||
|
void OpenIMManager::SetGroupApplyMemberFriend(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID, int rule) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
set_group_apply_member_friend(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,rule); |
||||||
|
} |
||||||
|
|
||||||
|
// get group member list
|
||||||
|
void OpenIMManager::GetGroupMemberList(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID,int filter,int offset,int count) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
get_group_member_list(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,filter,offset,count); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// get group member owner and admin
|
||||||
|
void OpenIMManager::GetGroupMemberOwnerAndAdmin(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID,const std::string& groupID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
get_group_member_owner_and_admin(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get group application list
|
||||||
|
void OpenIMManager::GetGroupMemberListByJoinTimeFilter(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, int offset, int count, long long int joinTimeBegin, long long int joinTimeEnd, const std::string& filteruserIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* filteruserIDs_cs=const_cast<char*>(filteruserIDs.c_str()); |
||||||
|
get_group_member_list_by_join_time_filter(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,offset,count,joinTimeBegin,joinTimeEnd,filteruserIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// get specified group members info
|
||||||
|
void OpenIMManager::GetSpecifiedGroupMembersInfo(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID,const std::string& groupID, const std::string& memberIDList) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* memberIDList_cs=const_cast<char*>(memberIDList.c_str()); |
||||||
|
get_specified_group_members_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,memberIDList_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// kick group members
|
||||||
|
void OpenIMManager::KickGroupMember(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* reason_cs=const_cast<char*>(reason.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
kick_group_member(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,reason_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// transfers the ownership of a group
|
||||||
|
void OpenIMManager::TransferGroupOwner(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& groupID, const std::string& memberID, const std::string& notifyMsg) |
||||||
|
{ |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* memberID_cs=const_cast<char*>(memberID.c_str()); |
||||||
|
char* notifyMsg_cs=const_cast<char*>(notifyMsg.c_str()); |
||||||
|
transfer_group_owner(_wrapper_callonce_cpp_function(callback),groupID_cs,memberID_cs,notifyMsg_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// invites users to a group
|
||||||
|
void OpenIMManager::InviteUserToGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* reason_cs=const_cast<char*>(reason.c_str()); |
||||||
|
char* userIDs_cs=const_cast<char*>(userIDs.c_str()); |
||||||
|
invite_user_to_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,reason_cs,userIDs_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// retrives the group application list as a recipient
|
||||||
|
void OpenIMManager::GetGroupApplicationListAsRecipient(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_group_application_list_as_recipient(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// retrives the group application list as an applicant
|
||||||
|
void OpenIMManager::GetGroupApplicationListAsApplicant(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
get_group_application_list_as_applicant(_wrapper_callonce_cpp_function(callback),operationID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// accept a group application
|
||||||
|
void OpenIMManager::AcceptGroupApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* fromUserID_cs=const_cast<char*>(fromUserID.c_str()); |
||||||
|
char* handleMsg_cs=const_cast<char*>(handleMsg.c_str()); |
||||||
|
accept_group_application(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,fromUserID_cs,handleMsg_cs); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// refuses a group application
|
||||||
|
void OpenIMManager::RefuseGroupApplication(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* fromUserID_cs=const_cast<char*>(fromUserID.c_str()); |
||||||
|
char* handleMsg_cs=const_cast<char*>(handleMsg.c_str()); |
||||||
|
refuse_group_application(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,fromUserID_cs,handleMsg_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// set group member nickname
|
||||||
|
void OpenIMManager::SetGroupMemberNickname(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, const std::string& groupMemberNickname) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
char* userID_cs=const_cast<char*>(userID.c_str()); |
||||||
|
char* groupMemberNickname_cs=const_cast<char*>(groupMemberNickname.c_str()); |
||||||
|
set_group_member_nickname(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,userID_cs,groupMemberNickname_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// search group members
|
||||||
|
void OpenIMManager::SearchGroupMembers(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback, const std::string& operationID, const std::string& searchParam) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* searchParam_cs=const_cast<char*>(searchParam.c_str()); |
||||||
|
search_group_members(_wrapper_callonce_cpp_function(callback),operationID_cs,searchParam_cs); |
||||||
|
} |
||||||
|
|
||||||
|
// check if the user has joined a certain group
|
||||||
|
void OpenIMManager::IsJoinGroup(const std::function<void(const std::string&, int, const std::string&, const std::string&)>& callback,const std::string& operationID, const std::string& groupID) |
||||||
|
{ |
||||||
|
char* operationID_cs=const_cast<char*>(operationID.c_str()); |
||||||
|
char* groupID_cs=const_cast<char*>(groupID.c_str()); |
||||||
|
is_join_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
#include <iostream> |
||||||
|
#include <functional> |
||||||
|
#include <thread> |
||||||
|
#include <chrono> |
||||||
|
#include "openimsdkcc.h" |
||||||
|
using namespace std; |
||||||
|
using namespace openim; |
||||||
|
|
||||||
|
// simple test
|
||||||
|
int main(){ |
||||||
|
auto sdkMgr = OpenIMManager::GetInstance(); |
||||||
|
string operationID="12345"; |
||||||
|
string uid= "openIM123"; |
||||||
|
string token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJvcGVuSU0xMjMiLCJQbGF0Zm9ybUlEIjo2LCJleHAiOjE3MDkxMjQ2NzYsIm5iZiI6MTcwMTM0ODM3NiwiaWF0IjoxNzAxMzQ4Njc2fQ.EqlV5TlpiElYhUOHCEcSrZOWi9ldrUMR1L4q0blvxs0"; |
||||||
|
string jsonString="{\"platformID\": 6, \"apiAddr\": \"http://14.29.168.56:10002\", \"wsAddr\":\"ws://14.29.168.56:10001\",\"dataDir\": \"./\", \"logLevel\": 5, \"isLogStandardOutput\": true, \"logFilePath\": \"./\", \"isExternalExtensions\": true}"; |
||||||
|
bool init_result = sdkMgr.InitSDK([](int event,const string& data){ |
||||||
|
cout<<"init> "<<"event:"<<event<<" data:"<<data<<endl; |
||||||
|
},operationID, jsonString); |
||||||
|
cout<<"init_result:"<<init_result<<endl; |
||||||
|
|
||||||
|
sdkMgr.SetConversationListener([](int event,const string& data){ |
||||||
|
cout<<"conversation> "<<"event:"<<event<<" data:"<<data<<endl; |
||||||
|
}); |
||||||
|
sdkMgr.SetAdvancedMsgListener([](int event,const string& data){ |
||||||
|
cout<<"advancedMsg> "<<"event:"<<event<<" data:"<<data<<endl; |
||||||
|
}); |
||||||
|
sdkMgr.Login([](const string& operationID ,int errCode,const string& errMsg, const string& data){ |
||||||
|
cout<<"login> " <<"operationID: "<<operationID<<" ,errCode: "<<errCode << "errMsg: "<<errMsg<< ", data: "<<data<<endl;
|
||||||
|
},operationID,uid,token); |
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(10)); |
||||||
|
|
||||||
|
// can only execute below function after login
|
||||||
|
string loginUserID=sdkMgr.GetLoginUser(); |
||||||
|
cout<<"loginUserID:"<<loginUserID<<endl; |
||||||
|
string operationID1="12345,create"; |
||||||
|
string messge=sdkMgr.CreateTextMessage(operationID1,"CCM"); |
||||||
|
string operationID2="12345,get_all_conversation_list"; |
||||||
|
sdkMgr.GetAllConversationList([](const string& operationID,int errCode ,const string& errMsg,const string& data){ |
||||||
|
cout<<"getAllConversationList> "<<"data:"<<data<<endl; |
||||||
|
},operationID2); |
||||||
|
// std::this_thread::sleep_for(std::chrono::seconds(1000));
|
||||||
|
while(true); |
||||||
|
return 0; |
||||||
|
}
|
@ -0,0 +1,82 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
/* |
||||||
|
#include <stdio.h> |
||||||
|
*/ |
||||||
|
import "C" |
||||||
|
|
||||||
|
var ( |
||||||
|
NO_ERR = C.int(0) |
||||||
|
NO_ERR_MSG = C.CString("") |
||||||
|
NO_DATA = C.CString("") |
||||||
|
NO_PROGRESS = C.int(0) |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
CONNECTING = iota |
||||||
|
CONNECT_SUCCESS |
||||||
|
CONNECT_FAILED |
||||||
|
KICKED_OFFLINE |
||||||
|
USER_TOKEN_EXPIRED |
||||||
|
JOINED_GROUP_ADDED |
||||||
|
JOINED_GROUP_DELETED |
||||||
|
GROUP_MEMBER_ADDED |
||||||
|
GROUP_MEMBER_DELETED |
||||||
|
GROUP_APPLICATION_ADDED |
||||||
|
GROUP_APPLICATION_DELETED |
||||||
|
GROUP_INFO_CHANGED |
||||||
|
GROUP_DISMISSED |
||||||
|
GROUP_MEMBER_INFO_CHANGED |
||||||
|
GROUP_APPLICATION_ACCEPTED |
||||||
|
GROUP_APPLICATION_REJECTED |
||||||
|
FRIEND_APPLICATION_ADDED |
||||||
|
FRIEND_APPLICATION_DELETED |
||||||
|
FRIEND_APPLICATION_ACCEPTED |
||||||
|
FRIEND_APPLICATION_REJECTED |
||||||
|
FRIEND_ADDED |
||||||
|
FRIEND_DELETED |
||||||
|
FRIEND_INFO_CHANGED |
||||||
|
BLACK_ADDED |
||||||
|
BLACK_DELETED |
||||||
|
SYNC_SERVER_START |
||||||
|
SYNC_SERVER_FINISH |
||||||
|
SYNC_SERVER_PROGRESS |
||||||
|
SYNC_SERVER_FAILED |
||||||
|
NEW_CONVERSATION |
||||||
|
CONVERSATION_CHANGED |
||||||
|
TOTAL_UNREAD_MESSAGE_COUNT_CHANGED |
||||||
|
RECV_NEW_MESSAGE |
||||||
|
RECV_C2C_READ_RECEIPT |
||||||
|
RECV_GROUP_READ_RECEIPT |
||||||
|
NEW_RECV_MESSAGE_REVOKED |
||||||
|
RECV_MESSAGE_EXTENSIONS_CHANGED |
||||||
|
RECV_MESSAGE_EXTENSIONS_DELETED |
||||||
|
RECV_MESSAGE_EXTENSIONS_ADDED |
||||||
|
RECV_OFFLINE_NEW_MESSAGE |
||||||
|
MSG_DELETED |
||||||
|
|
||||||
|
RECV_NEW_MESSAGES |
||||||
|
RECV_OFFLINE_NEW_MESSAGES |
||||||
|
|
||||||
|
SELF_INFO_UPDATED |
||||||
|
USER_STATUS_CHANGED |
||||||
|
|
||||||
|
RECV_CUSTOM_BUSINESS_MESSAGE |
||||||
|
|
||||||
|
MESSAGE_KV_INFO_CHANGED |
||||||
|
|
||||||
|
OPEN |
||||||
|
PART_SIZE |
||||||
|
HASH_PART_PROGRESS |
||||||
|
HASH_PART_COMPLETE |
||||||
|
UPLOAD_ID |
||||||
|
UPLOAD_PART_COMPLETE |
||||||
|
UPLOAD_COMPLETE |
||||||
|
COMPLETE |
||||||
|
CONVERSATION_USER_INPUT_STATUS_CHANGED |
||||||
|
RECV_ONLINE_ONLY_MESSAGE |
||||||
|
|
||||||
|
USER_TOKEN_INVALID |
||||||
|
|
||||||
|
ON_PROGRESS |
||||||
|
) |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,56 @@ |
|||||||
|
module github.com/openimsdk/openim-sdk-cpp |
||||||
|
|
||||||
|
go 1.22.7 |
||||||
|
|
||||||
|
require github.com/openimsdk/openim-sdk-core/v3 v3.8.3-patch.1 |
||||||
|
|
||||||
|
require ( |
||||||
|
github.com/bytedance/sonic v1.9.1 // indirect |
||||||
|
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect |
||||||
|
github.com/gabriel-vasile/mimetype v1.4.2 // indirect |
||||||
|
github.com/gin-contrib/sse v0.1.0 // indirect |
||||||
|
github.com/gin-gonic/gin v1.9.1 // indirect |
||||||
|
github.com/go-playground/locales v0.14.1 // indirect |
||||||
|
github.com/go-playground/universal-translator v0.18.1 // indirect |
||||||
|
github.com/go-playground/validator/v10 v10.14.0 // indirect |
||||||
|
github.com/goccy/go-json v0.10.2 // indirect |
||||||
|
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect |
||||||
|
github.com/golang/protobuf v1.5.4 // indirect |
||||||
|
github.com/google/go-cmp v0.6.0 // indirect |
||||||
|
github.com/gorilla/websocket v1.4.2 // indirect |
||||||
|
github.com/jinzhu/copier v0.4.0 // indirect |
||||||
|
github.com/jinzhu/inflection v1.0.0 // indirect |
||||||
|
github.com/jinzhu/now v1.1.5 // indirect |
||||||
|
github.com/json-iterator/go v1.1.12 // indirect |
||||||
|
github.com/klauspost/cpuid/v2 v2.2.6 // indirect |
||||||
|
github.com/leodido/go-urn v1.2.4 // indirect |
||||||
|
github.com/lestrrat-go/strftime v1.0.6 // indirect |
||||||
|
github.com/mattn/go-isatty v0.0.19 // indirect |
||||||
|
github.com/mattn/go-sqlite3 v1.14.22 // indirect |
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect |
||||||
|
github.com/modern-go/reflect2 v1.0.2 // indirect |
||||||
|
github.com/openimsdk/protocol v0.0.72-alpha.70 // indirect |
||||||
|
github.com/openimsdk/tools v0.0.50-alpha.21 // indirect |
||||||
|
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect |
||||||
|
github.com/pelletier/go-toml/v2 v2.0.8 // indirect |
||||||
|
github.com/pkg/errors v0.9.1 // indirect |
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect |
||||||
|
github.com/ugorji/go/codec v1.2.11 // indirect |
||||||
|
go.uber.org/atomic v1.7.0 // indirect |
||||||
|
go.uber.org/multierr v1.6.0 // indirect |
||||||
|
go.uber.org/zap v1.24.0 // indirect |
||||||
|
golang.org/x/arch v0.3.0 // indirect |
||||||
|
golang.org/x/crypto v0.27.0 // indirect |
||||||
|
golang.org/x/image v0.15.0 // indirect |
||||||
|
golang.org/x/net v0.29.0 // indirect |
||||||
|
golang.org/x/sync v0.8.0 // indirect |
||||||
|
golang.org/x/sys v0.25.0 // indirect |
||||||
|
golang.org/x/text v0.18.0 // indirect |
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect |
||||||
|
google.golang.org/grpc v1.68.0 // indirect |
||||||
|
google.golang.org/protobuf v1.35.1 // indirect |
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect |
||||||
|
gorm.io/driver/sqlite v1.5.5 // indirect |
||||||
|
gorm.io/gorm v1.25.10 // indirect |
||||||
|
nhooyr.io/websocket v1.8.10 // indirect |
||||||
|
) |
@ -0,0 +1,139 @@ |
|||||||
|
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= |
||||||
|
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= |
||||||
|
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= |
||||||
|
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= |
||||||
|
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= |
||||||
|
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= |
||||||
|
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= |
||||||
|
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= |
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= |
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= |
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= |
||||||
|
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= |
||||||
|
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= |
||||||
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= |
||||||
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= |
||||||
|
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= |
||||||
|
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= |
||||||
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= |
||||||
|
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= |
||||||
|
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= |
||||||
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= |
||||||
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= |
||||||
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= |
||||||
|
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= |
||||||
|
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= |
||||||
|
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= |
||||||
|
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= |
||||||
|
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= |
||||||
|
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= |
||||||
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= |
||||||
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= |
||||||
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= |
||||||
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= |
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= |
||||||
|
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= |
||||||
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= |
||||||
|
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= |
||||||
|
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= |
||||||
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= |
||||||
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= |
||||||
|
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= |
||||||
|
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= |
||||||
|
github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= |
||||||
|
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= |
||||||
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= |
||||||
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= |
||||||
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= |
||||||
|
github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= |
||||||
|
github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= |
||||||
|
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= |
||||||
|
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= |
||||||
|
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8= |
||||||
|
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= |
||||||
|
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4= |
||||||
|
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA= |
||||||
|
github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ= |
||||||
|
github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw= |
||||||
|
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= |
||||||
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= |
||||||
|
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= |
||||||
|
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= |
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= |
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= |
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= |
||||||
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= |
||||||
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= |
||||||
|
github.com/openimsdk/openim-sdk-core/v3 v3.8.3-patch.1 h1:wFhq3Sf8MWoSB4Zm/CyRbKvZvyt58bkUHuZlrfbHgL8= |
||||||
|
github.com/openimsdk/openim-sdk-core/v3 v3.8.3-patch.1/go.mod h1:paeW9bh3tdGDXAX7aiiiJFyYMCrr8nq01dhIMclqdNw= |
||||||
|
github.com/openimsdk/protocol v0.0.72-alpha.70 h1:j7vB81+rTthijRda2b8tlli9oWvPxr4yXHwZ8nPZIBQ= |
||||||
|
github.com/openimsdk/protocol v0.0.72-alpha.70/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M= |
||||||
|
github.com/openimsdk/tools v0.0.50-alpha.21 h1:ZKgSFkiBjz6KcNZlNwvrSoUYJ7K5Flan8wHuRBH3VqY= |
||||||
|
github.com/openimsdk/tools v0.0.50-alpha.21/go.mod h1:h1cYmfyaVtgFbKmb1Cfsl8XwUOMTt8ubVUQrdGtsUh4= |
||||||
|
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= |
||||||
|
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= |
||||||
|
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= |
||||||
|
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= |
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= |
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= |
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= |
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= |
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= |
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= |
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= |
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= |
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= |
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= |
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= |
||||||
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= |
||||||
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= |
||||||
|
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= |
||||||
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= |
||||||
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= |
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= |
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= |
||||||
|
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= |
||||||
|
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= |
||||||
|
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= |
||||||
|
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= |
||||||
|
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= |
||||||
|
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= |
||||||
|
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= |
||||||
|
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= |
||||||
|
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= |
||||||
|
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= |
||||||
|
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= |
||||||
|
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= |
||||||
|
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= |
||||||
|
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= |
||||||
|
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= |
||||||
|
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= |
||||||
|
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= |
||||||
|
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= |
||||||
|
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= |
||||||
|
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= |
||||||
|
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= |
||||||
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
||||||
|
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= |
||||||
|
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= |
||||||
|
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= |
||||||
|
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= |
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= |
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= |
||||||
|
google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= |
||||||
|
google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= |
||||||
|
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= |
||||||
|
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= |
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= |
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= |
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= |
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
||||||
|
gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= |
||||||
|
gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE= |
||||||
|
gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= |
||||||
|
gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= |
||||||
|
nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= |
||||||
|
nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= |
||||||
|
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= |
@ -0,0 +1,106 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
/* |
||||||
|
#include <stdio.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
typedef void (*CB_S)(char *); |
||||||
|
typedef void (*CB_I_S)(int,char *); |
||||||
|
typedef void (*CB_S_I_S_S)(char *,int,char *,char *); |
||||||
|
typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int); |
||||||
|
|
||||||
|
CB_S DebugPrint; |
||||||
|
|
||||||
|
void Call_CB_S(CB_S func,char* data) |
||||||
|
{ |
||||||
|
if(func == NULL){ |
||||||
|
printf("callback func is null\n"); |
||||||
|
return; |
||||||
|
} |
||||||
|
func(data); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void Call_CB_I_S(CB_I_S func,int event,char* data) |
||||||
|
{ |
||||||
|
if(func == NULL){ |
||||||
|
printf("callback func is null\n"); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (strcmp(data, "\"\"") == 0) { |
||||||
|
strcpy(data, ""); |
||||||
|
} |
||||||
|
func(event,data); |
||||||
|
if (data != NULL && data[0] != '\0') |
||||||
|
{ |
||||||
|
printf("this is not null data event\n"); |
||||||
|
free(data); |
||||||
|
} |
||||||
|
} |
||||||
|
void Call_CB_S_I_S_S(CB_S_I_S_S func,char* operationID, int errCode,char* errMsg,char* data) |
||||||
|
{ |
||||||
|
if(func == NULL){ |
||||||
|
printf("callback func is null\n"); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (strcmp(data, "\"\"") == 0) { |
||||||
|
strcpy(data, ""); |
||||||
|
} |
||||||
|
if (strlen(errMsg) != 0 && errMsg[strlen(errMsg) - 1] != '\0') { |
||||||
|
printf("ttttt %s\n",errMsg); |
||||||
|
strncat(errMsg, "\0", 1); |
||||||
|
} |
||||||
|
func(operationID,errCode,errMsg,data); |
||||||
|
if (errMsg != NULL && errMsg[0] != '\0') |
||||||
|
{ |
||||||
|
printf("this is not null errmsg %s\n",errMsg); |
||||||
|
free(errMsg); |
||||||
|
} |
||||||
|
if (data != NULL && data[0] != '\0') |
||||||
|
{ |
||||||
|
printf("this is not null data base,opid:%s,data:%s\n",operationID,data); |
||||||
|
free(data); |
||||||
|
} |
||||||
|
if (operationID != NULL) |
||||||
|
{ |
||||||
|
printf("this is not null operationID:%s\n",operationID); |
||||||
|
free(operationID); |
||||||
|
} |
||||||
|
} |
||||||
|
void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char* operationID,int errCode,char* errMsg,char* data,int progress) |
||||||
|
{ |
||||||
|
if(func == NULL){ |
||||||
|
printf("callback func is null\n"); |
||||||
|
return; |
||||||
|
} |
||||||
|
if(strcmp(data, "\"\"") == 0) { |
||||||
|
strcpy(data, ""); |
||||||
|
} |
||||||
|
func(operationID,errCode,errMsg,data,progress); |
||||||
|
if (errMsg != NULL && errMsg[0] != '\0') |
||||||
|
{ |
||||||
|
printf("this is not null errmsg\n"); |
||||||
|
free(errMsg); |
||||||
|
} |
||||||
|
if (data != NULL && data[0] != '\0') |
||||||
|
{ |
||||||
|
printf("this is not null data\n"); |
||||||
|
free(data); |
||||||
|
} |
||||||
|
if (operationID != NULL) |
||||||
|
{ |
||||||
|
printf("this is not null operationID\n"); |
||||||
|
free(operationID); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
enum CONN_EVENT{ |
||||||
|
CONNECTING, |
||||||
|
CONNECT_SUCCESS, |
||||||
|
CONNECT_FAILED, |
||||||
|
KICKED_OFFLINE, |
||||||
|
USER_TOKEN_EXPIRED |
||||||
|
|
||||||
|
}; |
||||||
|
*/ |
||||||
|
import "C" |
@ -0,0 +1,33 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
/* |
||||||
|
#include <stdio.h> |
||||||
|
#include <stdlib.h> |
||||||
|
*/ |
||||||
|
import "C" |
||||||
|
|
||||||
|
import ( |
||||||
|
"encoding/json" |
||||||
|
"strconv" |
||||||
|
"unsafe" |
||||||
|
) |
||||||
|
|
||||||
|
func parseBool(b int) bool { |
||||||
|
return !(b == 0) |
||||||
|
} |
||||||
|
|
||||||
|
func StructToJsonString(param interface{}) string { |
||||||
|
dataType, _ := json.Marshal(param) |
||||||
|
dataString := string(dataType) |
||||||
|
return dataString |
||||||
|
} |
||||||
|
|
||||||
|
func FreeCString(strList ...*C.char) { |
||||||
|
for _, str := range strList { |
||||||
|
C.free(unsafe.Pointer(str)) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func IntToString[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](intValue T) string { |
||||||
|
return strconv.FormatInt(int64(intValue), 10) |
||||||
|
} |
@ -0,0 +1,201 @@ |
|||||||
|
//go:build mage
|
||||||
|
// +build mage
|
||||||
|
|
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"os" |
||||||
|
"os/exec" |
||||||
|
"runtime" |
||||||
|
) |
||||||
|
|
||||||
|
var ( |
||||||
|
soName = "libopenimsdk" //
|
||||||
|
outPath = "../shared/" |
||||||
|
goSrc = "go" //
|
||||||
|
) |
||||||
|
|
||||||
|
var Default = Build |
||||||
|
|
||||||
|
// BuildAll compiles the project for all platforms.
|
||||||
|
func Build() { |
||||||
|
if err := BuildAndroid(); err != nil { |
||||||
|
fmt.Println("Error building for Android:", err) |
||||||
|
} |
||||||
|
if err := BuildIOS(); err != nil { |
||||||
|
fmt.Println("Error building for iOS:", err) |
||||||
|
} |
||||||
|
if err := BuildLinux(); err != nil { |
||||||
|
fmt.Println("Error building for Linux:", err) |
||||||
|
} |
||||||
|
if err := BuildWindows(); err != nil { |
||||||
|
fmt.Println("Error building for Windows:", err) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// BuildAndroid compiles the project for Android.
|
||||||
|
func BuildAndroid() error { |
||||||
|
architectures := []struct { |
||||||
|
Arch, API string |
||||||
|
}{ |
||||||
|
{"arm", "16"}, |
||||||
|
{"arm64", "21"}, |
||||||
|
{"386", "16"}, |
||||||
|
{"amd64", "21"}, |
||||||
|
} |
||||||
|
|
||||||
|
for _, arch := range architectures { |
||||||
|
if err := buildAndroid(outPath+"android", arch.Arch, arch.API); err != nil { |
||||||
|
fmt.Printf("Failed to build for %s: %v\n", arch.Arch, err) |
||||||
|
} |
||||||
|
} |
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
// BuildIOS compiles the project for iOS.
|
||||||
|
func BuildIOS() error { |
||||||
|
fmt.Println("Building for iOS...") |
||||||
|
outPath += "ios" |
||||||
|
arch := os.Getenv("GOARCH") |
||||||
|
|
||||||
|
if len(arch) == 0 { |
||||||
|
arch = runtime.GOARCH |
||||||
|
} |
||||||
|
|
||||||
|
os.Setenv("GOOS", "darwin") |
||||||
|
os.Setenv("GOARCH", arch) |
||||||
|
os.Setenv("CGO_ENABLED", "1") |
||||||
|
os.Setenv("CC", "clang") |
||||||
|
|
||||||
|
cmd := exec.Command("go", "build", "-buildmode=c-shared", "-o", outPath+"/"+soName+".dylib", ".") |
||||||
|
cmd.Dir = goSrc |
||||||
|
cmd.Env = os.Environ() |
||||||
|
cmd.Stderr = os.Stderr |
||||||
|
cmd.Stdout = os.Stdout |
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil { |
||||||
|
fmt.Printf("Failed to build for iOS: %v\n", err) |
||||||
|
return err |
||||||
|
} |
||||||
|
fmt.Println("Build for iOS completed successfully.") |
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
// BuildLinux compiles the project for Linux.
|
||||||
|
func BuildLinux() error { |
||||||
|
fmt.Println("Building for Linux...") |
||||||
|
|
||||||
|
outPath += "linux" |
||||||
|
arch := os.Getenv("GOARCH") |
||||||
|
cc := os.Getenv("CC") |
||||||
|
cxx := os.Getenv("CXX") |
||||||
|
|
||||||
|
if len(arch) == 0 { |
||||||
|
arch = runtime.GOARCH |
||||||
|
} |
||||||
|
|
||||||
|
if len(cc) == 0 { |
||||||
|
cc = "gcc" |
||||||
|
} |
||||||
|
|
||||||
|
if len(cxx) != 0 { |
||||||
|
os.Setenv("CXX", cxx) |
||||||
|
} |
||||||
|
|
||||||
|
os.Setenv("GOOS", "linux") |
||||||
|
os.Setenv("GOARCH", arch) |
||||||
|
os.Setenv("CGO_ENABLED", "1") |
||||||
|
os.Setenv("CC", cc) //
|
||||||
|
|
||||||
|
cmd := exec.Command("go", "build", "-buildmode=c-shared", "-trimpath", "-ldflags=-s -w", "-o", outPath+"/"+soName+".so", ".") |
||||||
|
cmd.Dir = goSrc |
||||||
|
cmd.Env = os.Environ() |
||||||
|
cmd.Stderr = os.Stderr |
||||||
|
cmd.Stdout = os.Stdout |
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil { |
||||||
|
fmt.Printf("Failed to build for Linux: %v\n", err) |
||||||
|
return err |
||||||
|
} |
||||||
|
fmt.Println("Build for Linux completed successfully.") |
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
// BuildWindows compiles the project for Windows.
|
||||||
|
func BuildWindows() error { |
||||||
|
fmt.Println("Building for Windows...") |
||||||
|
|
||||||
|
outPath += "windows" |
||||||
|
arch := os.Getenv("GOARCH") |
||||||
|
cc := os.Getenv("CC") |
||||||
|
cxx := os.Getenv("CXX") |
||||||
|
|
||||||
|
if len(arch) == 0 { |
||||||
|
arch = runtime.GOARCH |
||||||
|
} |
||||||
|
|
||||||
|
if len(cc) == 0 { |
||||||
|
cc = "gcc" |
||||||
|
} |
||||||
|
|
||||||
|
if len(cxx) != 0 { |
||||||
|
os.Setenv("CXX", cxx) |
||||||
|
} |
||||||
|
|
||||||
|
os.Setenv("GOOS", "windows") |
||||||
|
os.Setenv("GOARCH", arch) |
||||||
|
os.Setenv("CGO_ENABLED", "1") |
||||||
|
os.Setenv("CC", cc) |
||||||
|
|
||||||
|
cmd := exec.Command("go", "build", "-buildmode=c-shared", "-trimpath", "-ldflags=-s -w", "-o", outPath+"/"+soName+".dll", ".") |
||||||
|
cmd.Dir = goSrc |
||||||
|
cmd.Env = os.Environ() |
||||||
|
cmd.Stderr = os.Stderr |
||||||
|
cmd.Stdout = os.Stdout |
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil { |
||||||
|
fmt.Printf("Failed to build for Windows: %v\n", err) |
||||||
|
return err |
||||||
|
} |
||||||
|
fmt.Println("Build for Windows completed successfully.") |
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
// buildAndroid builds the Android library for the specified architecture.
|
||||||
|
func buildAndroid(aOutPath, arch, apiLevel string) error { |
||||||
|
fmt.Printf("Building for %s...\n", arch) |
||||||
|
|
||||||
|
ndkPath := os.Getenv("ANDROID_NDK_HOME") |
||||||
|
osSuffix := "" |
||||||
|
if runtime.GOOS == "windows" { |
||||||
|
osSuffix = ".cmd" //
|
||||||
|
} |
||||||
|
|
||||||
|
ccBasePath := ndkPath + "/toolchains/llvm/prebuilt/" + runtime.GOOS + "-x86_64/bin/" |
||||||
|
|
||||||
|
var cc string |
||||||
|
switch arch { |
||||||
|
case "arm": |
||||||
|
cc = ccBasePath + "armv7a-linux-androideabi" + apiLevel + "-clang" + osSuffix |
||||||
|
case "arm64": |
||||||
|
cc = ccBasePath + "aarch64-linux-android" + apiLevel + "-clang" + osSuffix |
||||||
|
case "386": |
||||||
|
cc = ccBasePath + "i686-linux-android" + apiLevel + "-clang" + osSuffix |
||||||
|
case "amd64": |
||||||
|
cc = ccBasePath + "x86_64-linux-android" + apiLevel + "-clang" + osSuffix |
||||||
|
} |
||||||
|
|
||||||
|
env := []string{ |
||||||
|
"CGO_ENABLED=1", |
||||||
|
"GOOS=android", |
||||||
|
"GOARCH=" + arch, |
||||||
|
"CC=" + cc, |
||||||
|
} |
||||||
|
cmd := exec.Command("go", "build", "-buildmode=c-shared", "-trimpath", "-ldflags=-s -w", "-o", aOutPath+"/"+arch+"/"+soName+".so", ".") |
||||||
|
cmd.Stderr = os.Stderr |
||||||
|
cmd.Stdout = os.Stdout |
||||||
|
cmd.Dir = goSrc |
||||||
|
cmd.Env = append(os.Environ(), env...) |
||||||
|
return cmd.Run() |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.dll export.go constant.go protocol.go tools.go |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
g++ -shared -fPIC -o openimsdkcc.dll openimsdkcc.cc openimsdk.dll |
@ -0,0 +1,2 @@ |
|||||||
|
gcc -o test.exe -L. openimsdk.dll test.c |
||||||
|
test.exe |
@ -0,0 +1,9 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
rm ./openimsdk.so ./openimsdk.h |
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.so export.go constant.go protocol.go tools.go |
||||||
|
|
||||||
|
|
||||||
|
# build cpp sdk |
||||||
|
rm ./openimsdkcc.so |
||||||
|
g++ -fPIC -shared -o openimsdkcc.so openimsdkcc.cc ./openimsdk.so |
@ -0,0 +1,3 @@ |
|||||||
|
gcc -o test.exe -L. openimsdk.dll test.c |
||||||
|
|
||||||
|
::gcc -o test.exe -L ../../shared/windows -l libopenimsdk test.c |
@ -0,0 +1,32 @@ |
|||||||
|
set NDK_PATH=D:\android_sdk\ndk-bundle |
||||||
|
set SO_NAME=libopenimsdk |
||||||
|
set OUT_PATH=android\ |
||||||
|
|
||||||
|
set CGO_ENABLED=1 |
||||||
|
|
||||||
|
REM Generate armeabi-v7a |
||||||
|
set GOOS=android |
||||||
|
set GOARCH=arm |
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi16-clang.cmd |
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%armeabi-v7a%SO_NAME%.so export.go constant.go protocol.go tools.go |
||||||
|
|
||||||
|
REM Generate arm64-v8a |
||||||
|
set GOARCH=arm64 |
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android21-clang.cmd |
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%arm64-v8a%SO_NAME%.so export.go constant.go protocol.go tools.go |
||||||
|
|
||||||
|
REM Generate x86 |
||||||
|
set GOARCH=386 |
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\i686-linux-android16-clang.cmd |
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%x86%SO_NAME%.so export.go constant.go protocol.go tools.go |
||||||
|
|
||||||
|
REM Generate x86_64 |
||||||
|
set GOARCH=amd64 |
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\x86_64-linux-android21-clang.cmd |
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%x86_64%SO_NAME%.so export.go constant.go protocol.go tools.go |
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@ |
|||||||
|
export GOOS=darwin |
||||||
|
export GOARCH=arm64 |
||||||
|
export CGO_ENABLED=1 |
||||||
|
export CC=clang |
||||||
|
|
||||||
|
go build -buildmode=c-shared -o libopenimsdk.dylib export.go constant.go protocol.go tools.go |
||||||
|
|
||||||
|
|
@ -0,0 +1,316 @@ |
|||||||
|
/* Code generated by cmd/cgo; DO NOT EDIT. */ |
||||||
|
|
||||||
|
/* package command-line-arguments */ |
||||||
|
|
||||||
|
|
||||||
|
#line 1 "cgo-builtin-export-prolog" |
||||||
|
|
||||||
|
#include <stddef.h> |
||||||
|
|
||||||
|
#ifndef GO_CGO_EXPORT_PROLOGUE_H |
||||||
|
#define GO_CGO_EXPORT_PROLOGUE_H |
||||||
|
|
||||||
|
#ifndef GO_CGO_GOSTRING_TYPEDEF |
||||||
|
typedef struct { const char *p; ptrdiff_t n; } _GoString_; |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
||||||
|
|
||||||
|
/* Start of preamble from import "C" comments. */ |
||||||
|
|
||||||
|
|
||||||
|
#line 3 "export.go" |
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
typedef void (*CB_S)(char *); |
||||||
|
typedef void (*CB_I_S)(int,char *); |
||||||
|
typedef void (*CB_S_I_S_S)(char *,int,char *,char *); |
||||||
|
typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int); |
||||||
|
extern void Call_CB_S(CB_S func,char* data); |
||||||
|
extern void Call_CB_I_S(CB_I_S func,int event,char* data); |
||||||
|
extern void Call_CB_S_I_S_S(CB_S_I_S_S func,char *,int errCode,char* errMsg,char* data); |
||||||
|
extern void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char *,int errCode,char* errMsg,char* data,int progress); |
||||||
|
extern CB_S DebugPrint; |
||||||
|
|
||||||
|
|
||||||
|
#line 1 "cgo-generated-wrapper" |
||||||
|
|
||||||
|
|
||||||
|
/* End of preamble from import "C" comments. */ |
||||||
|
|
||||||
|
|
||||||
|
/* Start of boilerplate cgo prologue. */ |
||||||
|
#line 1 "cgo-gcc-export-header-prolog" |
||||||
|
|
||||||
|
#ifndef GO_CGO_PROLOGUE_H |
||||||
|
#define GO_CGO_PROLOGUE_H |
||||||
|
|
||||||
|
typedef signed char GoInt8; |
||||||
|
typedef unsigned char GoUint8; |
||||||
|
typedef short GoInt16; |
||||||
|
typedef unsigned short GoUint16; |
||||||
|
typedef int GoInt32; |
||||||
|
typedef unsigned int GoUint32; |
||||||
|
typedef long long GoInt64; |
||||||
|
typedef unsigned long long GoUint64; |
||||||
|
typedef GoInt64 GoInt; |
||||||
|
typedef GoUint64 GoUint; |
||||||
|
typedef size_t GoUintptr; |
||||||
|
typedef float GoFloat32; |
||||||
|
typedef double GoFloat64; |
||||||
|
#ifdef _MSC_VER |
||||||
|
#include <complex.h> |
||||||
|
typedef _Fcomplex GoComplex64; |
||||||
|
typedef _Dcomplex GoComplex128; |
||||||
|
#else |
||||||
|
typedef float _Complex GoComplex64; |
||||||
|
typedef double _Complex GoComplex128; |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
static assertion to make sure the file is being used on architecture |
||||||
|
at least with matching size of GoInt. |
||||||
|
*/ |
||||||
|
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; |
||||||
|
|
||||||
|
#ifndef GO_CGO_GOSTRING_TYPEDEF |
||||||
|
typedef _GoString_ GoString; |
||||||
|
#endif |
||||||
|
typedef void *GoMap; |
||||||
|
typedef void *GoChan; |
||||||
|
typedef struct { void *t; void *v; } GoInterface; |
||||||
|
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; |
||||||
|
|
||||||
|
#endif |
||||||
|
|
||||||
|
/* End of boilerplate cgo prologue. */ |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
extern void set_print(CB_S print); |
||||||
|
extern void set_group_listener(CB_I_S cCallback); |
||||||
|
extern void set_conversation_listener(CB_I_S cCallback); |
||||||
|
extern void set_advanced_msg_listener(CB_I_S cCallback); |
||||||
|
extern void set_batch_msg_listener(CB_I_S cCallback); |
||||||
|
extern void set_user_listener(CB_I_S cCallback); |
||||||
|
extern void set_friend_listener(CB_I_S cCallback); |
||||||
|
extern void set_custom_business_listener(CB_I_S cCallback); |
||||||
|
extern GoUint8 init_sdk(CB_I_S cCallback, char* operationID, char* config); |
||||||
|
extern void un_init_sdk(char* operationID); |
||||||
|
extern void login(CB_S_I_S_S cCallback, char* operationID, char* uid, char* token); |
||||||
|
extern void logout(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void set_app_background_status(CB_S_I_S_S cCallback, char* operationID, int isBackground); |
||||||
|
extern void network_status_changed(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern GoInt get_login_status(char* operationID); |
||||||
|
extern char* get_login_user(); |
||||||
|
extern char* create_text_message(char* operationID, char* text); |
||||||
|
extern char* create_advanced_text_message(char* operationID, char* text, char* messageEntityList); |
||||||
|
extern char* create_text_at_message(char* operationID, char* text, char* atUserList, char* atUsersInfo, char* message); |
||||||
|
extern char* create_location_message(char* operationID, char* description, double longitude, double latitude); |
||||||
|
extern char* create_custom_message(char* operationID, char* data, char* extension, char* description); |
||||||
|
extern char* create_quote_message(char* operationID, char* text, char* message); |
||||||
|
extern char* create_advanced_quote_message(char* operationID, char* text, char* message, char* messageEntityList); |
||||||
|
extern char* create_card_message(char* operationID, char* cardInfo); |
||||||
|
extern char* create_video_message_from_full_path(char* operationID, char* videoFullPath, char* videoType, long long int duration, char* snapshotFullPath); |
||||||
|
extern char* create_image_message_from_full_path(char* operationID, char* imageFullPath); |
||||||
|
extern char* create_sound_message_from_full_path(char* operationID, char* soundPath, long long int duration); |
||||||
|
extern char* create_file_message_from_full_path(char* operationID, char* fileFullPath, char* fileName); |
||||||
|
extern char* create_image_message(char* operationID, char* imagePath); |
||||||
|
extern char* create_image_message_by_url(char* operationID, char* sourcePath, char* sourcePicture, char* bigPicture, char* snapshotPicture); |
||||||
|
extern char* create_sound_message_by_url(char* operationID, char* soundBaseInfo); |
||||||
|
extern char* create_sound_message(char* operationID, char* soundPath, long long int duration); |
||||||
|
extern char* create_video_message_by_url(char* operationID, char* videoBaseInfo); |
||||||
|
extern char* create_video_message(char* operationID, char* videoPath, char* videoType, long long int duration, char* snapshotPath); |
||||||
|
extern char* create_file_message_by_url(char* operationID, char* fileBaseInfo); |
||||||
|
extern char* create_file_message(char* operationID, char* filePath, char* fileName); |
||||||
|
extern char* create_merger_message(char* operationID, char* messageList, char* title, char* summaryList); |
||||||
|
extern char* create_face_message(char* operationID, int index, char* data); |
||||||
|
extern char* create_forward_message(char* operationID, char* m); |
||||||
|
extern void get_all_conversation_list(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void get_conversation_list_split(CB_S_I_S_S cCallback, char* operationID, int offset, int count); |
||||||
|
extern void get_one_conversation(CB_S_I_S_S cCallback, char* operationID, int sessionType, char* sourceID); |
||||||
|
extern void get_multiple_conversation(CB_S_I_S_S cCallback, char* operationID, char* conversationIDList); |
||||||
|
extern void set_conversation_msg_destruct_time(CB_S_I_S_S cCallback, char* operationID, char* conversationID, long long int msgDestructTime); |
||||||
|
extern void set_conversation_is_msg_destruct(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int isMsgDestruct); |
||||||
|
extern void hide_conversation(CB_S_I_S_S cCallback, char* operationID, char* conversationID); |
||||||
|
extern void get_conversation_recv_message_opt(CB_S_I_S_S cCallback, char* operationID, char* conversationIDList); |
||||||
|
extern void set_conversation_draft(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* draftText); |
||||||
|
extern void reset_conversation_group_at_type(CB_S_I_S_S cCallback, char* operationID, char* conversationID); |
||||||
|
extern void pin_conversation(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int isPinned); |
||||||
|
extern void set_conversation_private_chat(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int isPrivate); |
||||||
|
extern void set_conversation_burn_duration(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int duration); |
||||||
|
extern void set_conversation_recv_message_opt(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int opt); |
||||||
|
extern void get_total_unread_msg_count(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern char* get_at_all_tag(char* operationID); |
||||||
|
extern char* get_conversation_id_by_session_type(char* operationID, char* sourceID, int sessionType); |
||||||
|
extern void send_message(CB_S_I_S_S_I cCallback, char* operationID, char* message, char* recvID, char* groupID, char* offlinePushInfo); |
||||||
|
extern void send_message_not_oss(CB_S_I_S_S_I cCallback, char* operationID, char* message, char* recvID, char* groupID, char* offlinePushInfo); |
||||||
|
extern void find_message_list(CB_S_I_S_S cCallback, char* operationID, char* findMessageOptions); |
||||||
|
extern void get_advanced_history_message_list(CB_S_I_S_S cCallback, char* operationID, char* getMessageOptions); |
||||||
|
extern void get_advanced_history_message_list_reverse(CB_S_I_S_S cCallback, char* operationID, char* getMessageOptions); |
||||||
|
extern void revoke_message(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID); |
||||||
|
extern void typing_status_update(CB_S_I_S_S cCallback, char* operationID, char* recvID, char* msgTip); |
||||||
|
extern void mark_conversation_message_as_read(CB_S_I_S_S cCallback, char* operationID, char* conversationID); |
||||||
|
extern void delete_message_from_local_storage(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID); |
||||||
|
extern void delete_message(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID); |
||||||
|
extern void hide_all_conversations(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void delete_all_msg_from_local_and_svr(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void delete_all_msg_from_local(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void clear_conversation_and_delete_all_msg(CB_S_I_S_S cCallback, char* operationID, char* conversationID); |
||||||
|
extern void delete_conversation_and_delete_all_msg(CB_S_I_S_S cCallback, char* operationID, char* conversationID); |
||||||
|
extern void insert_single_message_to_local_storage(CB_S_I_S_S cCallback, char* operationID, char* message, char* recvID, char* sendID); |
||||||
|
extern void insert_group_message_to_local_storage(CB_S_I_S_S cCallback, char* operationID, char* message, char* groupID, char* sendID); |
||||||
|
extern void search_local_messages(CB_S_I_S_S cCallback, char* operationID, char* searchParam); |
||||||
|
extern void set_message_local_ex(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID, char* localEx); |
||||||
|
extern void get_users_info(CB_S_I_S_S cCallback, char* operationID, char* userIDs); |
||||||
|
extern void get_users_info_with_cache(CB_S_I_S_S cCallback, char* operationID, char* userIDs, char* groupID); |
||||||
|
extern void get_users_info_from_srv(CB_S_I_S_S cCallback, char* operationID, char* userIDs); |
||||||
|
extern void set_self_info(CB_S_I_S_S cCallback, char* operationID, char* userInfo); |
||||||
|
extern void set_global_recv_message_opt(CB_S_I_S_S cCallback, char* operationID, int opt); |
||||||
|
extern void get_self_user_info(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void update_msg_sender_info(CB_S_I_S_S cCallback, char* operationID, char* nickname, char* faceURL); |
||||||
|
extern void subscribe_users_status(CB_S_I_S_S cCallback, char* operationID, char* userIDs); |
||||||
|
extern void unsubscribe_users_status(CB_S_I_S_S cCallback, char* operationID, char* userIDs); |
||||||
|
extern void get_subscribe_users_status(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void get_user_status(CB_S_I_S_S cCallback, char* operationID, char* userIDs); |
||||||
|
|
||||||
|
// =====================================================friend===============================================
|
||||||
|
//
|
||||||
|
extern void get_specified_friends_info(CB_S_I_S_S cCallback, char* operationID, char* userIDList); |
||||||
|
extern void get_friend_list(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void get_friend_list_page(CB_S_I_S_S cCallback, char* operationID, int offset, int count); |
||||||
|
extern void search_friends(CB_S_I_S_S cCallback, char* operationID, char* searchParam); |
||||||
|
extern void check_friend(CB_S_I_S_S cCallback, char* operationID, char* userIDList); |
||||||
|
extern void add_friend(CB_S_I_S_S cCallback, char* operationID, char* userIDReqMsg); |
||||||
|
extern void set_friend_remark(CB_S_I_S_S cCallback, char* operationID, char* userIDRemark); |
||||||
|
extern void delete_friend(CB_S_I_S_S cCallback, char* operationID, char* friendUserID); |
||||||
|
extern void get_friend_application_list_as_recipient(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void get_friend_application_list_as_applicant(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void accept_friend_application(CB_S_I_S_S cCallback, char* operationID, char* userIDHandleMsg); |
||||||
|
extern void refuse_friend_application(CB_S_I_S_S cCallback, char* operationID, char* userIDHandleMsg); |
||||||
|
extern void add_black(CB_S_I_S_S cCallback, char* operationID, char* blackUserID); |
||||||
|
extern void get_black_list(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
extern void remove_black(CB_S_I_S_S cCallback, char* operationID, char* removeUserID); |
||||||
|
|
||||||
|
// =====================================================group===============================================
|
||||||
|
// CreateGroup creates a group
|
||||||
|
//
|
||||||
|
extern void create_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupReqInfo); |
||||||
|
|
||||||
|
// JoinGroup joins a group
|
||||||
|
//
|
||||||
|
extern void join_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cReqMsg, int cJoinSource); |
||||||
|
|
||||||
|
// QuitGroup quits a group
|
||||||
|
//
|
||||||
|
extern void quit_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); |
||||||
|
|
||||||
|
// DismissGroup dismisses a group
|
||||||
|
//
|
||||||
|
extern void dismiss_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); |
||||||
|
|
||||||
|
// ChangeGroupMute changes the mute status of a group
|
||||||
|
//
|
||||||
|
extern void change_group_mute(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cIsMute); |
||||||
|
|
||||||
|
// ChangeGroupMemberMute changes the mute status of a group member
|
||||||
|
//
|
||||||
|
extern void change_group_member_mute(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserID, int cMutedSeconds); |
||||||
|
|
||||||
|
// SetGroupMemberRoleLevel sets the role level of a group member
|
||||||
|
//
|
||||||
|
extern void set_group_member_role_level(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserID, int cRoleLevel); |
||||||
|
|
||||||
|
// SetGroupMemberInfo sets the information of a group member
|
||||||
|
//
|
||||||
|
extern void set_group_member_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupMemberInfo); |
||||||
|
|
||||||
|
// GetJoinedGroupList retrieves the list of joined groups
|
||||||
|
//
|
||||||
|
extern void get_joined_group_list(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
|
||||||
|
// GetSpecifiedGroupsInfo retrieves the information of specified groups
|
||||||
|
//
|
||||||
|
extern void get_specified_groups_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupIDList); |
||||||
|
|
||||||
|
// SearchGroups searches for groups
|
||||||
|
//
|
||||||
|
extern void search_groups(CB_S_I_S_S cCallback, char* operationID, char* cSearchParam); |
||||||
|
|
||||||
|
// SetGroupInfo sets the information of a group
|
||||||
|
//
|
||||||
|
extern void set_group_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupInfo); |
||||||
|
|
||||||
|
// SetGroupVerification sets the verification mode of a group
|
||||||
|
//
|
||||||
|
extern void set_group_verification(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cVerification); |
||||||
|
|
||||||
|
// SetGroupLookMemberInfo sets the member information visibility of a group
|
||||||
|
//
|
||||||
|
extern void set_group_look_member_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cRule); |
||||||
|
|
||||||
|
// SetGroupApplyMemberFriend sets the friend rule for group applicants
|
||||||
|
//
|
||||||
|
extern void set_group_apply_member_friend(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cRule); |
||||||
|
|
||||||
|
// GetGroupMemberList retrieves the list of group members
|
||||||
|
//
|
||||||
|
extern void get_group_member_list(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cFilter, int cOffset, int cCount); |
||||||
|
|
||||||
|
// GetGroupMemberOwnerAndAdmin retrieves the owner and admin members of a group
|
||||||
|
//
|
||||||
|
extern void get_group_member_owner_and_admin(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); |
||||||
|
|
||||||
|
// GetGroupMemberListByJoinTimeFilter retrieves the list of group members filtered by join time
|
||||||
|
//
|
||||||
|
extern void get_group_member_list_by_join_time_filter(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cOffset, int cCount, long long int cJoinTimeBegin, long long int cJoinTimeEnd, char* cFilterUserIDList); |
||||||
|
|
||||||
|
// GetSpecifiedGroupMembersInfo retrieves the information of specified group members
|
||||||
|
//
|
||||||
|
extern void get_specified_group_members_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserIDList); |
||||||
|
|
||||||
|
// KickGroupMember kicks group members
|
||||||
|
//
|
||||||
|
extern void kick_group_member(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cReason, char* cUserIDList); |
||||||
|
|
||||||
|
// TransferGroupOwner transfers the ownership of a group
|
||||||
|
//
|
||||||
|
extern void transfer_group_owner(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cNewOwnerUserID); |
||||||
|
|
||||||
|
// InviteUserToGroup invites users to a group
|
||||||
|
//
|
||||||
|
extern void invite_user_to_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cReason, char* cUserIDList); |
||||||
|
|
||||||
|
// GetGroupApplicationListAsRecipient retrieves the group application list as a recipient
|
||||||
|
//
|
||||||
|
extern void get_group_application_list_as_recipient(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
|
||||||
|
// GetGroupApplicationListAsApplicant retrieves the group application list as an applicant
|
||||||
|
//
|
||||||
|
extern void get_group_application_list_as_applicant(CB_S_I_S_S cCallback, char* operationID); |
||||||
|
|
||||||
|
// AcceptGroupApplication accepts a group application
|
||||||
|
//
|
||||||
|
extern void accept_group_application(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cFromUserID, char* cHandleMsg); |
||||||
|
|
||||||
|
// RefuseGroupApplication refuses a group application
|
||||||
|
//
|
||||||
|
extern void refuse_group_application(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cFromUserID, char* cHandleMsg); |
||||||
|
|
||||||
|
// SetGroupMemberNickname sets the nickname of a group member
|
||||||
|
//
|
||||||
|
extern void set_group_member_nickname(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserID, char* cGroupMemberNickname); |
||||||
|
|
||||||
|
// SearchGroupMembers searches for group members
|
||||||
|
//
|
||||||
|
extern void search_group_members(CB_S_I_S_S cCallback, char* operationID, char* cSearchParam); |
||||||
|
|
||||||
|
// IsJoinGroup checks if the user has joined a group
|
||||||
|
//
|
||||||
|
extern void is_join_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,18 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
|
||||||
|
# if arg 1 is c,or is none,means test c sdk |
||||||
|
# if arg 1 is cc,means test cpp sdk |
||||||
|
|
||||||
|
rm ./test |
||||||
|
if [ "$1" == "c" ] || [ "$1" == "" ]; then |
||||||
|
echo "test c sdk" |
||||||
|
gcc -o test ./test.c ./openimsdk.so |
||||||
|
./test |
||||||
|
exit 0 |
||||||
|
elif [ "$1" == "cc" ]; then |
||||||
|
echo "test cpp sdk" |
||||||
|
g++ -o test ./test.cc ./openimsdk.so ./openimsdkcc.so |
||||||
|
./test |
||||||
|
exit 0 |
||||||
|
fi |
@ -0,0 +1 @@ |
|||||||
|
# openim-sdk-cpp |
@ -0,0 +1 @@ |
|||||||
|
# openim-sdk-cpp |
@ -0,0 +1 @@ |
|||||||
|
# openim-sdk-cpp |
@ -0,0 +1 @@ |
|||||||
|
# openim-sdk-cpp |
Loading…
Reference in new issue