CN111865756A - Qt-based cross-multi-platform instant messaging method and system - Google Patents

Qt-based cross-multi-platform instant messaging method and system Download PDF

Info

Publication number
CN111865756A
CN111865756A CN202010498683.3A CN202010498683A CN111865756A CN 111865756 A CN111865756 A CN 111865756A CN 202010498683 A CN202010498683 A CN 202010498683A CN 111865756 A CN111865756 A CN 111865756A
Authority
CN
China
Prior art keywords
message
instant messaging
network
network message
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010498683.3A
Other languages
Chinese (zh)
Inventor
王伟东
郭家鑫
焦晓武
陈磊
符兴斌
徐建堂
王金生
杨宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China National Software & Service Co ltd
Original Assignee
China National Software & Service Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China National Software & Service Co ltd filed Critical China National Software & Service Co ltd
Priority to CN202010498683.3A priority Critical patent/CN111865756A/en
Publication of CN111865756A publication Critical patent/CN111865756A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Abstract

The invention discloses a Qt-based cross-multi-platform instant messaging method and a system. The method comprises the following steps: 1) initializing an instant messaging interface by utilizing a Qt component library, and adding an html interface for instant messaging into the Qt WebView component library; then setting a key response event and an interface response event; 2) a sender generates a network message through an instant communication program, encrypts a message body in the network message by adopting a set encryption and decryption algorithm, stores the length of the encrypted message body in a message header, and then sends the network message to a server; 3) the server side decrypts the received network message through the set encryption and decryption algorithm and stores the decrypted network message into a server log, and then encrypts a message body in the network message again and sends the encrypted message body to a receiver; 4) and after decrypting the received network message by the set encryption and decryption algorithm, the receiver performs corresponding operation on the network message according to the message operation type in the network message.

Description

Qt-based cross-multi-platform instant messaging method and system
Technical Field
The invention relates to the field of domestic operating system development platforms, in particular to a cross-platform data communication method and system based on Qt.
Background
At present, under the strong support of the country, the domestic software and hardware technology is gradually developing towards the modernization, automation and intellectualization. For better confidentiality and convenience, more organizations, companies and individuals accept a home platform and a home operating system.
However, with the development of domestic platforms, there are problems that the instant messaging processing in the office system cannot be satisfied under the domestic operating system and the Windows operating system at the same time, and further, various problems of repeated work and unsmooth communication occur.
Disclosure of Invention
In order to overcome the defect that the existing instant messaging software cannot be compatible with a Linux platform and a domestic system platform, the invention provides a cross-platform data communication method and a cross-platform data communication system based on Qt, which can achieve unified and complete message receiving and sending operation by independently designing the data transmission function of instant messaging client terminals and Ethernet communication so as to be independent of a specific operating system and hardware environment, and have better flexibility, expansibility and low coupling.
The technical scheme of the invention is as follows:
a Qt-based cross multi-platform instant messaging method comprises the following steps:
1) Initializing an instant messaging interface of an instant messaging program by utilizing a Qt component library, and adding an html interface for instant messaging into the Qt WebView component library; then, setting a key response event of the instant messaging interface by using a Qt standard library; setting an interface response event for the instant messaging program to analyze the received background service sending message and then generate an interface response and display the interface response on the html interface;
2) the sender generates a network message through the instant messaging program, wherein the network message comprises a message header and a message body, the message header comprises a message body size and a message body type, and the message body comprises a message type, a message sender, a message receiver, a message state, a message content and a message operation type; then, encrypting a message body in the network message by adopting a set encryption and decryption algorithm, storing the length of the encrypted message body in a message header, and then sending the processed network message to a server;
3) the server side decrypts the received network message through the set encryption and decryption algorithm and stores the decrypted network message into a server log, and then encrypts a message body in the network message through the set encryption and decryption algorithm again and sends the encrypted message body to a receiver;
4) And after decrypting the received network message by the set encryption and decryption algorithm, the receiver performs corresponding operation on the network message according to the message operation type in the network message.
Further, in step 2), the network message is encrypted after being compressed, and then sent to the server; in the step 3), the server decompresses the decrypted network message and stores the decompressed network message into a server log; and for the network message which needs to be sent to the receiver, the message body in the network message is encrypted and sent to the receiver again by setting an encryption and decryption algorithm after the compression.
Further, the instant messenger program creates a local Sqlite database through the Sqlite component in the Qt Sql library, and then stores the set common data in the Sqlite database.
Furthermore, reading or writing the common data in the sqlite database is realized through a QSqlQuery method.
Further, the message body of the network message is decrypted according to the message body length stored in the message header of the network message.
Furthermore, the receiver analyzes the network message by using different methods according to different message types, and determines the result of the network message according to the message state.
Further, the set encryption and decryption algorithm is a national password 4 algorithm.
A Qt-based cross-multi-platform instant messaging system is characterized by comprising a client and a server; wherein the content of the first and second substances,
the client is used for generating a network message through an instant messaging program, wherein the network message comprises a message header and a message body, the message header comprises a message body size and a message body type, and the message body comprises a message type, a message sender, a message receiver, a message state, a message content and a message operation type; then, encrypting a message body in the network message by adopting a set encryption and decryption algorithm, storing the length of the encrypted message body in a message header, and then sending the processed network message to a server; after the received network message is decrypted through the set encryption and decryption algorithm, corresponding operation is carried out on the network message according to the message operation type in the network message; initializing an instant messaging interface of an instant messaging program by utilizing a Qt component library, and adding an html interface for instant messaging into the Qt WebView component library; then, setting a key response event of the instant messaging interface by using a Qt standard library; setting an interface response event for the instant messaging program to analyze the received background service sending message and then generate an interface response and display the interface response on the html interface;
The server side is used for decrypting the received network message through the set encryption and decryption algorithm and storing the decrypted network message into a server log, and then encrypting the message body in the network message through the set encryption and decryption algorithm again and sending the encrypted message body to the corresponding client side.
A Qt-based cross-multi-platform instant messaging terminal is characterized by comprising an instant messaging program, wherein the instant messaging program initializes an instant messaging interface by utilizing a Qt component library and adds an html interface for instant messaging into a QtWebView component library; setting a key response event of the instant messaging interface by using a Qt standard library; setting an interface response event for the instant messaging program to analyze the received background service sending message and then generate an interface response and display the interface response on the html interface; the instant messaging program is used for generating a network message according to information to be sent, wherein the network message comprises a message header and a message body, the message header comprises a message body size and a message body type, and the message body comprises a message type, a message sender, a message receiver, a message state, a message content and a message operation type; then, encrypting a message body in the network message by adopting a set encryption and decryption algorithm, storing the length of the encrypted message body in a message header, and then sending the processed network message to a server; and after decrypting the received network message through the set encryption and decryption algorithm, performing corresponding operation on the network message according to the message operation type in the network message.
In a first aspect, the present invention provides a Qt-based interface design method, comprising:
a) and initializing an interface: the interface comprises an interface size, buttons, a search box, an input box, a picture display module, a character display module, a tree data display module and the like which are added according to design.
b) And html interface: in order to conveniently adapt to each operating system, the html page is integrated by using the Qt WebView component library, and the interface layout and response are comprehensive, convenient and quick.
c) And setting a response event: the existing Qt standard library can provide a specific function interface for setting the key response event.
d) Interface response event: and the program receives the message sent by the background service, and displays the message on the html page through the interface response after the message is analyzed.
In a second aspect, the present invention provides an ethernet communication method based on an existing Qt network component library, including:
a) formulating a network message sending rule: different from the message structure of the traditional instant messaging software, in order to better analyze the network message, the network message comprises a message header and a message body, the message header comprises the message body size, the message body type and the like, the message type comprises a chat message, a file message, a push message, a state message and other receivers without considering the content of the message body, when the message body is decrypted and decompressed through a national password 4 algorithm and zlib, the length of the message body before decryption and decompression needs to be known, so the message body can be decrypted and decompressed according to the message body size contained in the message header, and the message is distributed to different message body processing methods according to the message body type; the message body comprises a message type, a message sender, a message receiver, a message state, a message content, a message operation type and the like, and the receiver analyzes the message by using different methods according to different message types; determining the result of the message according to the message state; the message operation comprises adding friends, deleting friends, modifying personal information, modifying state, modifying name of discussion group, deleting discussion, creating discussion group, adding members of discussion group, deleting members of discussion group, kicking out members of discussion group, etc., and different operations can be performed on the message through message operation types. The server side distributes the message according to the message receiver.
b) Compressing and encrypting the message body: in order to accelerate the message sending speed and improve the message security, the message body is encrypted by using a national password 4 algorithm, and the length of the encrypted message body is stored in a message header for a receiver to decrypt.
c) Server side message distribution: after receiving the message, the server side decrypts the message by using a national password 4 algorithm through the message body length in the message header and decompresses the message according to zlib, and then stores the message into a server log; and after the log is successfully stored, the message is encrypted again through the national password 4 algorithm and compressed by zlib and then is sent to a receiver.
d) And receiver message processing: and after the message received by the receiver is decrypted by a national password 4 algorithm and decompressed according to zlib, the operations such as storage, html page display, service processing and the like are carried out according to the operation type and the content of the message.
In a third aspect, the present invention provides a method for locally storing data based on Qt, including:
a) and creating a local database: a local Sqlite database is created by the Sqlite component in the Qt Sql library. The Sqlite database is a lightweight database that implements a self-sufficient, serverless, zero-configuration, transactional SQL database engine.
b) And data persistence: in order to realize convenient storage and reading of data and solve the problem of frequently requesting data from a server, the invention stores the common data in the sqlite database to realize convenient access to the data.
Compared with the prior art, the invention has the following remarkable advantages:
a) and spanning the platform. Qt is a language supporting platforms such as Windows All, unix, linux, Mac os All, etc. One set of codes is really realized, and multiple ends are public, so that the workload and the maintenance amount of developers are greatly reduced.
b) And modularization. The system terminal can be divided into a plurality of modules such as a communication module, a group module, an address list module, an expression module, a chat background module, a file transceiving module, a message management module and the like, can realize the simultaneous development of various modules, reduces the working time, and has better expansibility, flexibility and low coupling.
c) The front end and the rear end are separated. The system only discusses the client terminal of instant messaging, does not need to consider the back-end service realization logic during development, unifies the communication mode of receiving and sending through Ethernet messages, and improves the convenience of development.
Drawings
FIG. 1 is a diagram of a client database architecture of the present invention.
Detailed Description
The present invention is further described below.
a) And initializing a control: the length and the width of each module are set by initializing a chat box, an input box, a search box, a button, a calendar box and the like required by the interface by using a component library of the Qt, and the setting is realized by a function calling mode, wherein the function is provided by a Qt standard library.
b) And integrating html interface: and storing the designed html interface into a code folder, adding the html interface into a QWebView component by calling the QtWebKitWidgets component, and realizing mutual calling with js methods in the html page by methods in the QWebView.
c) And setting a response event: and binding the monitoring event of each module through a specific signal/slot mechanism of Qt, and realizing the setting of a response event through a method in a signal trigger slot function.
d) And message distribution: after receiving the message, the receiving end decompresses and decrypts the message body according to the size of the message body in the message header, and then distributes the message to different processing methods for processing according to the message type in the message body.
e) Message encryption/decryption: the message sender encrypts the message body by using a state cipher 4 encryption algorithm, and the message receiver decrypts the message body by using a state cipher 4 decryption algorithm; the same key must be used for message encryption/decryption.
f) Message compression/decompression: the message sender compresses the message body by using a zlib compression method, and the message receiver decompresses the message body by using a zlib decompression method.
g) Local data persistence: and (3) creating a local sqlite component library by utilizing the QtSql component, and realizing the reading and writing of data by a QSqlQuery method.
Although specific details of the invention, algorithms and figures are disclosed for illustrative purposes, these are intended to aid in the understanding of the contents of the invention and the implementation in accordance therewith, as will be appreciated by those skilled in the art: various substitutions, changes and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. The invention should not be limited to the preferred embodiments and drawings disclosed herein, but rather should be defined only by the scope of the appended claims.

Claims (10)

1. A Qt-based cross multi-platform instant messaging method comprises the following steps:
1) initializing an instant messaging interface of an instant messaging program by utilizing a Qt component library, and adding an html interface for instant messaging into the Qt WebView component library; then, setting a key response event of the instant messaging interface by using a Qt standard library; setting an interface response event for the instant messaging program to analyze the received background service sending message and then generate an interface response and display the interface response on the html interface;
2) the sender generates a network message through the instant messaging program, wherein the network message comprises a message header and a message body, the message header comprises a message body size and a message body type, and the message body comprises a message type, a message sender, a message receiver, a message state, a message content and a message operation type; then, encrypting a message body in the network message by adopting a set encryption and decryption algorithm, storing the length of the encrypted message body in a message header, and then sending the processed network message to a server;
3) The server side decrypts the received network message through the set encryption and decryption algorithm and stores the decrypted network message into a server log, and then encrypts a message body in the network message through the set encryption and decryption algorithm again and sends the encrypted message body to a receiver;
4) and after decrypting the received network message by the set encryption and decryption algorithm, the receiver performs corresponding operation on the network message according to the message operation type in the network message.
2. The method of claim 1, wherein in step 2), the network message is compressed, encrypted and then sent to the server; in the step 3), the server decompresses the decrypted network message and stores the decompressed network message into a server log; and for the network message which needs to be sent to the receiver, the message body in the network message is encrypted and sent to the receiver again by setting an encryption and decryption algorithm after the compression.
3. The method as claimed in claim 1 or 2, wherein the instant messenger program creates a local Sqlite database through the Sqlite component in the Qt Sql library and then stores the set general data in the Sqlite database.
4. The method of claim 3, wherein reading or writing the common data in the sqlite database is accomplished by a QSqlQuery method.
5. The method of claim 1, wherein the message body of the network message is decrypted based on a message body length stored in a header of the network message.
6. The method of claim 1, wherein the recipient parses the network message using different methods based on different message types, and determines the result of the network message based on the message status.
7. The method of claim 1, wherein the set encryption/decryption algorithm is a national password 4 algorithm.
8. A Qt-based cross-multi-platform instant messaging system is characterized by comprising a client and a server; wherein the content of the first and second substances,
the client is used for generating a network message through an instant messaging program, wherein the network message comprises a message header and a message body, the message header comprises a message body size and a message body type, and the message body comprises a message type, a message sender, a message receiver, a message state, a message content and a message operation type; then, encrypting a message body in the network message by adopting a set encryption and decryption algorithm, storing the length of the encrypted message body in a message header, and then sending the processed network message to a server; after the received network message is decrypted through the set encryption and decryption algorithm, corresponding operation is carried out on the network message according to the message operation type in the network message; initializing an instant messaging interface of an instant messaging program by utilizing a Qt component library, and adding an html interface for instant messaging into the Qt WebView component library; then, setting a key response event of the instant messaging interface by using a Qt standard library; setting an interface response event for the instant messaging program to analyze the received background service sending message and then generate an interface response and display the interface response on the html interface;
The server side is used for decrypting the received network message through the set encryption and decryption algorithm and storing the decrypted network message into a server log, and then encrypting the message body in the network message through the set encryption and decryption algorithm again and sending the encrypted message body to the corresponding client side.
9. The system of claim 8, wherein the message body of the network message is decrypted based on a message body length stored in a header of the network message.
10. A Qt-based cross-multi-platform instant messaging terminal is characterized by comprising an instant messaging program, wherein the instant messaging program initializes an instant messaging interface by utilizing a Qt component library and adds an html interface for instant messaging into a QtWebView component library; setting a key response event of the instant messaging interface by using a Qt standard library; setting an interface response event for the instant messaging program to analyze the received background service sending message and then generate an interface response and display the interface response on the html interface; the instant messaging program is used for generating a network message according to information to be sent, wherein the network message comprises a message header and a message body, the message header comprises a message body size and a message body type, and the message body comprises a message type, a message sender, a message receiver, a message state, a message content and a message operation type; then, encrypting a message body in the network message by adopting a set encryption and decryption algorithm, storing the length of the encrypted message body in a message header, and then sending the processed network message to a server; and after decrypting the received network message through the set encryption and decryption algorithm, performing corresponding operation on the network message according to the message operation type in the network message.
CN202010498683.3A 2020-06-04 2020-06-04 Qt-based cross-multi-platform instant messaging method and system Pending CN111865756A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010498683.3A CN111865756A (en) 2020-06-04 2020-06-04 Qt-based cross-multi-platform instant messaging method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010498683.3A CN111865756A (en) 2020-06-04 2020-06-04 Qt-based cross-multi-platform instant messaging method and system

Publications (1)

Publication Number Publication Date
CN111865756A true CN111865756A (en) 2020-10-30

Family

ID=72985101

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010498683.3A Pending CN111865756A (en) 2020-06-04 2020-06-04 Qt-based cross-multi-platform instant messaging method and system

Country Status (1)

Country Link
CN (1) CN111865756A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117579394A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Safe transmission method based on TCP protocol under client condition

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050075543A1 (en) * 2003-10-03 2005-04-07 Calabrese Charles A. Method of anonymous medical testing and providing the patient with the test results
CN101132273A (en) * 2006-08-24 2008-02-27 北京大唐高鸿软件技术有限公司 Safe transmission method for text transport protocol message
US7921292B1 (en) * 2003-04-04 2011-04-05 Voltage Security, Inc. Secure messaging systems
CN103023880A (en) * 2012-11-26 2013-04-03 烽火通信科技股份有限公司 Device and method for integration of video communication service and DLNA (Digital Living Network Alliance) service
US20140258968A1 (en) * 2013-03-05 2014-09-11 Research In Motion Limited Visual Representation Of Edits For Collaborative Application Development
CN104361089A (en) * 2014-11-17 2015-02-18 哈尔滨理工大学 Cross-platform document management system based on Qt
CN111082929A (en) * 2019-11-25 2020-04-28 西安戴森电子技术有限公司 Method for realizing encrypted instant communication

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7921292B1 (en) * 2003-04-04 2011-04-05 Voltage Security, Inc. Secure messaging systems
US20050075543A1 (en) * 2003-10-03 2005-04-07 Calabrese Charles A. Method of anonymous medical testing and providing the patient with the test results
CN101132273A (en) * 2006-08-24 2008-02-27 北京大唐高鸿软件技术有限公司 Safe transmission method for text transport protocol message
CN103023880A (en) * 2012-11-26 2013-04-03 烽火通信科技股份有限公司 Device and method for integration of video communication service and DLNA (Digital Living Network Alliance) service
US20140258968A1 (en) * 2013-03-05 2014-09-11 Research In Motion Limited Visual Representation Of Edits For Collaborative Application Development
CN104361089A (en) * 2014-11-17 2015-02-18 哈尔滨理工大学 Cross-platform document management system based on Qt
CN111082929A (en) * 2019-11-25 2020-04-28 西安戴森电子技术有限公司 Method for realizing encrypted instant communication

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
吴捷等: "《Linux下基于Qt4的跨平台聊天系统设计》", 《电脑知识与技术》 *
杨超: "《基于SIP/SIMPLE协议的即时通信终端的设计与实现》", 《中国优秀硕士学位论文全文数据库》 *
雷停: "《基于QT的跨平台网络通信的设计与实现》", 《网络安全技术与应用》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117579394A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Safe transmission method based on TCP protocol under client condition
CN117579394B (en) * 2024-01-16 2024-04-09 麒麟软件有限公司 Secure transmission method based on TCP protocol under multi-client condition

Similar Documents

Publication Publication Date Title
CN108520183B (en) Data storage method and device
US5751814A (en) File encryption method
US8281125B1 (en) System and method for providing secure remote email access
EP0909068B1 (en) Method and apparatus for structured communication
US20090060198A1 (en) Secure message transport using message segmentation
US20060101124A1 (en) Method and apparatus for mass email transmission
US7607007B2 (en) Method and apparatus for message routing in a computer system
CN113343305A (en) Intersection calculation method, device and equipment of private data and storage medium
CN107292197B (en) Data encryption method, data decryption method, encryption device and decryption device
US20140095860A1 (en) Architecture for cloud computing using order preserving encryption
KR102445290B1 (en) Information processing method, apparatus, device, and readable storage medium
CN104243149A (en) Encrypting and decrypting method, device and server
CN101616100B (en) Methods for pushing, receiving and transmitting mail, mail server and mail client
CN111865756A (en) Qt-based cross-multi-platform instant messaging method and system
US8005902B2 (en) System and method for accelerated dynamic data message generation and transmission
US10742404B2 (en) System and asynchronous protocol for verifiable secret sharing
EP1868351B1 (en) File distribution system
US9276915B2 (en) Privacy system
CN114679324B (en) Data exchange method, tool, system, equipment and medium
CN110175305B (en) Data processing method, data processing device, computer equipment and storage medium
CN111193659B (en) File processing method and device based on instant chat tool
Yang et al. Forensic analysis of popular Chinese internet applications
CN113612827A (en) Method and system for efficiently transmitting financial information in batches
CN103685493A (en) Internet file storing method and system
CN111832056B (en) Method and system for generating two-dimensional code

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201030

RJ01 Rejection of invention patent application after publication