Initalize array for reading the uid string attribute. More cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40437 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -199,14 +199,14 @@ MailboxWatcher::MessageReceived(BMessage* message)
|
|||||||
message->FindInt64("directory", &ref.directory);
|
message->FindInt64("directory", &ref.directory);
|
||||||
message->FindString("name", &name);
|
message->FindString("name", &name);
|
||||||
ref.set_name(name);
|
ref.set_name(name);
|
||||||
//TODO not thread safe
|
|
||||||
fProtocol->AppendMessage(ref);
|
fProtocol->AppendMessage(ref);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_ENTRY_REMOVED:
|
case B_ENTRY_REMOVED:
|
||||||
message->FindInt32("device", &nref.device);
|
message->FindInt32("device", &nref.device);
|
||||||
message->FindInt64("node", &nref.node);
|
message->FindInt64("node", &nref.node);
|
||||||
//TODO not thread safe
|
|
||||||
fProtocol->DeleteMessage(nref);
|
fProtocol->DeleteMessage(nref);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ FetchMessageCommand::Handle(const BString& response)
|
|||||||
BString headerSize = IMAPParser::RemovePrimitiveFromLeft(extracted);
|
BString headerSize = IMAPParser::RemovePrimitiveFromLeft(extracted);
|
||||||
headerSize = IMAPParser::ExtractNextElement(headerSize);
|
headerSize = IMAPParser::ExtractNextElement(headerSize);
|
||||||
int32 size = atoi(headerSize);
|
int32 size = atoi(headerSize);
|
||||||
TRACE("Header size %i\n", (int)size);
|
|
||||||
status_t status = fConnectionReader.ReadToFile(size, data);
|
status_t status = fConnectionReader.ReadToFile(size, data);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
if (!fOutData)
|
if (!fOutData)
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ IMAPStorage::AddNewMessage(int32 uid, int32 flags, BPositionIO** file)
|
|||||||
|
|
||||||
BPath filePath = fMailboxPath;
|
BPath filePath = fMailboxPath;
|
||||||
filePath.Append(fileName);
|
filePath.Append(fileName);
|
||||||
TRACE("file name %s\n", filePath.Path());
|
TRACE("AddNewMessage %s\n", filePath.Path());
|
||||||
BFile* newFile = new BFile(filePath.Path(), B_READ_WRITE | B_CREATE_FILE
|
BFile* newFile = new BFile(filePath.Path(), B_READ_WRITE | B_CREATE_FILE
|
||||||
| B_ERASE_FILE);
|
| B_ERASE_FILE);
|
||||||
if (newFile == NULL)
|
if (newFile == NULL)
|
||||||
@@ -238,7 +238,8 @@ IMAPStorage::DeleteMessage(int32 uid)
|
|||||||
BPath filePath = fMailboxPath;
|
BPath filePath = fMailboxPath;
|
||||||
filePath.Append(storageEntry.fileName);
|
filePath.Append(storageEntry.fileName);
|
||||||
BEntry entry(filePath.Path());
|
BEntry entry(filePath.Path());
|
||||||
TRACE("delete %s\n", filePath.Path());
|
TRACE("IMAPStorage::DeleteMessage %s, %ld\n", filePath.Path(), uid);
|
||||||
|
|
||||||
status_t status = entry.Remove();
|
status_t status = entry.Remove();
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -439,8 +440,11 @@ IMAPStorage::_ReadFilesThread()
|
|||||||
|
|
||||||
StorageMailEntry entry;
|
StorageMailEntry entry;
|
||||||
entry.fileName = ref.name;
|
entry.fileName = ref.name;
|
||||||
if (ReadUniqueID(node, entry.uid) != B_OK)
|
if (ReadUniqueID(node, entry.uid) != B_OK) {
|
||||||
|
TRACE("IMAPStorage::_ReadFilesThread() failed to read uid %s\n",
|
||||||
|
ref.name);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (node.ReadAttr("MAIL:server_flags", B_INT32_TYPE, 0, &entry.flags,
|
if (node.ReadAttr("MAIL:server_flags", B_INT32_TYPE, 0, &entry.flags,
|
||||||
sizeof(int32)) != sizeof(int32))
|
sizeof(int32)) != sizeof(int32))
|
||||||
@@ -475,9 +479,11 @@ IMAPStorage::_WriteFlags(int32 flags, BNode& node)
|
|||||||
status_t
|
status_t
|
||||||
IMAPStorage::ReadUniqueID(BNode& node, int32& uid)
|
IMAPStorage::ReadUniqueID(BNode& node, int32& uid)
|
||||||
{
|
{
|
||||||
char uidString[256];
|
const uint32 kMaxUniqueLength = 32;
|
||||||
|
char uidString[kMaxUniqueLength];
|
||||||
|
memset(uidString, 0, kMaxUniqueLength);
|
||||||
if (node.ReadAttr("MAIL:unique_id", B_STRING_TYPE, 0, uidString,
|
if (node.ReadAttr("MAIL:unique_id", B_STRING_TYPE, 0, uidString,
|
||||||
256) < 0)
|
kMaxUniqueLength) < 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
uid = atoi(uidString);
|
uid = atoi(uidString);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user