Getting Server/Client Type

Hi,

in the NextCloud client i changed the code a little bit so now i can get the instruction type

when i add a new file whether on web or client, i get the instruction CSYNC_INSTRUCTION_NEW.

the question is how to know if im uploading to the server or downloading to the client?

if i do understand, you made your own fork of the client sync ? right.

In that case, the behaviors you’re getting is related to your own code, so other people won’t experience it.

First possibility, create own fork in github and post your code, so people can test it.

Otherwise, without seeing your code, i wonder how to help you.

Concerning the CSYNC_INSTRUCTION_NEW, you’de better check with libcsync community.

Hi,

actually I don’t have the modification on the GitHub since im using the SVN.

about the code im using the CMD project I don’t want to use the GUI interface, so I need to send messages to a server about the updates that the client has, the changes are at the cmd.cpp so I added this function

void Cmd::itemCompletedSlot(const SyncFileItemPtr & item)
{
	QString fileName = item->destination();
	quint64 pSize = item->_previousSize;
	quint64 size = item->_size;
	std::string fileNameStr = fileName.toUtf8().constData();
	auto original = item->_originalFile;
	std::string originalStr = original.toUtf8().constData();
	auto file = item->_file;
	std::string fileStr = file.toUtf8().constData();
	///below code is for sending a message through TCP of what was the event that was made to the file, delete, rename or added
	csync_instructions_e instruction = item->_instruction;
	std::string instructionMessage;
	switch (instruction)
	{
		case CSYNC_INSTRUCTION_REMOVE:
		{
			instructionMessage = "Deleted";
			break;
		}
		case CSYNC_INSTRUCTION_RENAME:
		{
			instructionMessage = "Renamed";
			break;
		}
		case CSYNC_INSTRUCTION_NEW:
		{
			instructionMessage = "Added";
			break;
		}
	}

you can see that I have three events, remove, rename and add, simply I need a way so I can make the events four…remove, rename, add(upload) and add(download), the only thing i saw that can solve this issue this part of code is this line, but i don’t know how to return the value of REMOTE_REPLICA to the nextcloudcmd project

and what is the “libcsync community” ?
Thanks

The nextcloud sync client is using the libsync project and some code from it… https://android.googlesource.com/platform/system/core/+/master/libsync/