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:
Clemens Zeidler 2011-02-10 23:42:27 +00:00
parent c16bcdfcb7
commit 7c03514cad
3 changed files with 14 additions and 8 deletions

View File

@ -199,14 +199,14 @@ MailboxWatcher::MessageReceived(BMessage* message)
message->FindInt64("directory", &ref.directory);
message->FindString("name", &name);
ref.set_name(name);
//TODO not thread safe
fProtocol->AppendMessage(ref);
break;
case B_ENTRY_REMOVED:
message->FindInt32("device", &nref.device);
message->FindInt64("node", &nref.node);
//TODO not thread safe
fProtocol->DeleteMessage(nref);
break;

View File

@ -394,7 +394,7 @@ FetchMessageCommand::Handle(const BString& response)
BString headerSize = IMAPParser::RemovePrimitiveFromLeft(extracted);
headerSize = IMAPParser::ExtractNextElement(headerSize);
int32 size = atoi(headerSize);
TRACE("Header size %i\n", (int)size);
status_t status = fConnectionReader.ReadToFile(size, data);
if (status != B_OK) {
if (!fOutData)

View File

@ -170,7 +170,7 @@ IMAPStorage::AddNewMessage(int32 uid, int32 flags, BPositionIO** file)
BPath filePath = fMailboxPath;
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
| B_ERASE_FILE);
if (newFile == NULL)
@ -238,7 +238,8 @@ IMAPStorage::DeleteMessage(int32 uid)
BPath filePath = fMailboxPath;
filePath.Append(storageEntry.fileName);
BEntry entry(filePath.Path());
TRACE("delete %s\n", filePath.Path());
TRACE("IMAPStorage::DeleteMessage %s, %ld\n", filePath.Path(), uid);
status_t status = entry.Remove();
if (status != B_OK)
return status;
@ -439,8 +440,11 @@ IMAPStorage::_ReadFilesThread()
StorageMailEntry entry;
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;
}
if (node.ReadAttr("MAIL:server_flags", B_INT32_TYPE, 0, &entry.flags,
sizeof(int32)) != sizeof(int32))
@ -475,9 +479,11 @@ IMAPStorage::_WriteFlags(int32 flags, BNode& node)
status_t
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,
256) < 0)
kMaxUniqueLength) < 0)
return B_ERROR;
uid = atoi(uidString);
return B_OK;