PURPLE_INPUT_WRITE works again
This commit is contained in:
parent
a560778c90
commit
f7cd1346cc
2 changed files with 11 additions and 3 deletions
|
@ -45,6 +45,7 @@ using namespace log4cxx;
|
|||
static LoggerPtr logger_libpurple = log4cxx::Logger::getLogger("libpurple");
|
||||
static LoggerPtr logger = log4cxx::Logger::getLogger("backend");
|
||||
int m_sock;
|
||||
static int writeInput;
|
||||
|
||||
using namespace Transport;
|
||||
|
||||
|
@ -61,6 +62,8 @@ template <class T> std::string stringOf(T object) {
|
|||
return (os.str());
|
||||
}
|
||||
|
||||
static void transportDataReceived(gpointer data, gint source, PurpleInputCondition cond);
|
||||
|
||||
class SpectrumNetworkPlugin;
|
||||
|
||||
GKeyFile *keyfile;
|
||||
|
@ -907,6 +910,8 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
|
|||
|
||||
void sendData(const std::string &string) {
|
||||
write(m_sock, string.c_str(), string.size());
|
||||
if (writeInput == 0)
|
||||
writeInput = purple_input_add(m_sock, PURPLE_INPUT_WRITE, &transportDataReceived, NULL);
|
||||
}
|
||||
|
||||
void readyForData() {
|
||||
|
@ -1750,6 +1755,10 @@ static void transportDataReceived(gpointer data, gint source, PurpleInputConditi
|
|||
np->handleDataRead(d);
|
||||
}
|
||||
else {
|
||||
if (writeInput != 0) {
|
||||
purple_input_remove(writeInput);
|
||||
writeInput = 0;
|
||||
}
|
||||
np->readyForData();
|
||||
}
|
||||
}
|
||||
|
@ -1852,7 +1861,6 @@ int main(int argc, char **argv) {
|
|||
m_sock = create_socket(host, port);
|
||||
|
||||
purple_input_add(m_sock, PURPLE_INPUT_READ, &transportDataReceived, NULL);
|
||||
// purple_input_add(m_sock, PURPLE_INPUT_WRITE, &transportDataReceived, NULL);
|
||||
|
||||
np = new SpectrumNetworkPlugin(host, port);
|
||||
bool libev = KEYFILE_STRING("service", "eventloop") == "libev";
|
||||
|
|
|
@ -11,10 +11,10 @@ admin_password=test
|
|||
#cert=server.pfx #patch to PKCS#12 certificate
|
||||
#cert_password=test #password to that certificate if any
|
||||
users_per_backend=10
|
||||
#backend=/home/hanzz/code/libtransport/backends/libpurple/spectrum2_libpurple_backend
|
||||
backend=/home/hanzz/code/libtransport/backends/libpurple/spectrum2_libpurple_backend
|
||||
#backend=/usr/bin/mono /home/hanzz/code/networkplugin-csharp/msnp-sharp-backend/bin/Debug/msnp-sharp-backend.exe
|
||||
#backend=/home/hanzz/code/libtransport/backends/frotz/spectrum2_frotz_backend
|
||||
backend=/home/hanzz/code/libtransport/backends/libircclient-qt/spectrum2_libircclient-qt_backend
|
||||
#backend=/home/hanzz/code/libtransport/backends/libircclient-qt/spectrum2_libircclient-qt_backend
|
||||
#protocol=prpl-msn
|
||||
protocol=any
|
||||
#protocol=prpl-icq
|
||||
|
|
Loading…
Add table
Reference in a new issue