Page MenuHomePhorge

D170.1775908156.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D170.1775908156.diff

diff --git a/src/commands/eimap_command_getmetadata.erl b/src/commands/eimap_command_getmetadata.erl
--- a/src/commands/eimap_command_getmetadata.erl
+++ b/src/commands/eimap_command_getmetadata.erl
@@ -23,13 +23,14 @@
%% Public API
new_command({ Folder }) -> new_command({ Folder, [] });
-new_command({ Folder, Attributes }) when is_list(Folder) -> new_command({ list_to_binary(Folder), Attributes });
new_command({ Folder, Attributes }) -> new_command({ Folder, Attributes, infinity, nomax });
+
+new_command({ Folder, Attributes, Depth, MaxSize }) when is_list(Folder) -> new_command({ list_to_binary(Folder), Attributes, Depth, MaxSize });
new_command({ Folder, Attributes, Depth, MaxSize }) ->
AttributesString = format_attributes(Attributes, <<>>),
DepthString = depth_param(Depth),
MaxSizeString = maxsize_param(MaxSize),
- Command = metadata_comand(DepthString, MaxSizeString, Folder, AttributesString),
+ Command = metadata_command(DepthString, MaxSizeString, Folder, AttributesString),
{ Command, multiline_response }.
process_line(<<"* METADATA ", Details/binary>>, Acc) ->
@@ -47,10 +48,10 @@
maxsize_param(Size) when is_integer(Size) -> Bin = integer_to_binary(Size), <<"MAXSIZE ", Bin/binary>>;
maxsize_param(_) -> <<>>.
-metadata_comand(<<>>, <<>>, Folder, Attributes) -> <<"GETMETADATA \"", Folder/binary, "\"", Attributes/binary>>;
-metadata_comand(Depth, <<>>, Folder, Attributes) -> <<"GETMETADATA (", Depth/binary, ") \"", Folder/binary, "\"", Attributes/binary>>;
-metadata_comand(<<>>, MaxSize, Folder, Attributes) -> <<"GETMETADATA (", MaxSize/binary, ") \"", Folder/binary, "\"", Attributes/binary>>;
-metadata_comand(Depth, MaxSize, Folder, Attributes) -> <<"GETMETADATA (", Depth/binary, " ", MaxSize/binary, ") \"", Folder/binary, "\"", Attributes/binary>>.
+metadata_command(<<>>, <<>>, Folder, Attributes) -> <<"GETMETADATA \"", Folder/binary, "\"", Attributes/binary>>;
+metadata_command(Depth, <<>>, Folder, Attributes) -> <<"GETMETADATA (", Depth/binary, ") \"", Folder/binary, "\"", Attributes/binary>>;
+metadata_command(<<>>, MaxSize, Folder, Attributes) -> <<"GETMETADATA (", MaxSize/binary, ") \"", Folder/binary, "\"", Attributes/binary>>;
+metadata_command(Depth, MaxSize, Folder, Attributes) -> <<"GETMETADATA (", Depth/binary, " ", MaxSize/binary, ") \"", Folder/binary, "\"", Attributes/binary>>.
format_attributes([], <<>>) -> <<>>;
format_attributes([], String) -> <<" (", String/binary, ")">>;
diff --git a/test/eimap_command_getmetadata_tests.erl b/test/eimap_command_getmetadata_tests.erl
--- a/test/eimap_command_getmetadata_tests.erl
+++ b/test/eimap_command_getmetadata_tests.erl
@@ -69,6 +69,7 @@
{ { <<"/my/folder">>, [<<"/shared/comment">>, "/private/comment"] }, { <<"GETMETADATA (DEPTH infinity) \"/my/folder\" (/shared/comment /private/comment)">>, multiline_response } },
{ { "/my/folder", [<<"/shared/comment">>, "/private/comment"] }, { <<"GETMETADATA (DEPTH infinity) \"/my/folder\" (/shared/comment /private/comment)">>, multiline_response } },
{ { <<"/my/folder">> }, { <<"GETMETADATA (DEPTH infinity) \"/my/folder\"">>, multiline_response } },
+ { { "/my/folder", [], 10, 100 }, { <<"GETMETADATA (DEPTH 10 MAXSIZE 100) \"/my/folder\"">>, multiline_response } },
{ { <<"/my/folder">>, [], 10, 100 }, { <<"GETMETADATA (DEPTH 10 MAXSIZE 100) \"/my/folder\"">>, multiline_response } },
{ { <<"/my/folder">>, [], 10, none}, { <<"GETMETADATA (DEPTH 10) \"/my/folder\"">>, multiline_response } },
{ { <<"/my/folder">>, [], none, 100 }, { <<"GETMETADATA (MAXSIZE 100) \"/my/folder\"">>, multiline_response } }

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 11, 11:49 AM (17 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18859927
Default Alt Text
D170.1775908156.diff (3 KB)

Event Timeline