Skip to content

Commit a912f82

Browse files
MythicLionManadamtharani
authored andcommitted
Added an accessor to test if the libetpan malformed address hack is supported at compile time, and updated the properties to not become true if it is not supported.
This makes it possible to test to see if libetpan and mailcore were compiled properly in the target framework.
1 parent 3f28030 commit a912f82

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

src/async/imap/MCIMAPAsyncSession.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,29 @@ bool IMAPAsyncSession::isCheckCertificateEnabled()
194194

195195
void IMAPAsyncSession::setEnableMalformedAddressHack(bool enabled)
196196
{
197+
#ifdef LIBETPAN_HAS_MALFORMED_ADDRESS_HACK
197198
mEnableMalformedAddressHack = enabled;
198199
for(unsigned int i = 0 ; i < mSessions->count() ; i ++) {
199200
IMAPAsyncConnection * connection = (IMAPAsyncConnection *) mSessions->objectAtIndex(i);
200201
connection->setEnableMalformedAddressHack(enabled);
201202
}
203+
#endif
202204
}
203205

204206
bool IMAPAsyncSession::enableMalformedAddressHack()
205207
{
206208
return mEnableMalformedAddressHack;
207209
}
208210

211+
bool IMAPAsyncSession::supportsMalformedAddressHack()
212+
{
213+
#ifdef LIBETPAN_HAS_MALFORMED_ADDRESS_HACK
214+
return true;
215+
#else
216+
return false;
217+
#endif
218+
}
219+
209220
void IMAPAsyncSession::setVoIPEnabled(bool enabled)
210221
{
211222
mVoIPEnabled = enabled;

src/async/imap/MCIMAPAsyncSession.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ namespace mailcore {
8181

8282
virtual void setEnableMalformedAddressHack(bool enabled);
8383
virtual bool enableMalformedAddressHack();
84+
virtual bool supportsMalformedAddressHack();
8485

8586
virtual void setVoIPEnabled(bool enabled);
8687
virtual bool isVoIPEnabled();

src/core/imap/MCIMAPSession.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ bool IMAPSession::isCheckCertificateEnabled()
531531

532532
void IMAPSession::setEnableMalformedAddressHack(bool enabled)
533533
{
534-
malformedAddressWorkaroundEnabled = enabled;
535534
#ifdef LIBETPAN_HAS_MALFORMED_ADDRESS_HACK
535+
malformedAddressWorkaroundEnabled = enabled;
536536
mailimap_set_malformed_address_workaround_enabled(mImap, enabled);
537537
#endif
538538
}

src/objc/imap/MCOIMAPSession.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
/** Enables or disables the malformed address hack for this session */
109109
@property (nonatomic, assign) BOOL enableMalformedAddressHack;
110110

111+
/** Returns true if malformed address hack support was complied, false if not */
112+
@property (nonatomic, readonly) BOOL supportsMalformedAddressHack;
113+
111114
/**
112115
Display name of the Gmail user. It will be nil if it's not a Gmail server.
113116

src/objc/imap/MCOIMAPSession.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ - (BOOL)enableMalformedAddressHack
129129
return _session->enableMalformedAddressHack();
130130
}
131131

132+
- (BOOL)supportsMalformedAddressHack
133+
{
134+
return _session->supportsMalformedAddressHack();
135+
}
136+
132137
- (MCOIMAPIdentity *) clientIdentity
133138
{
134139
return MCO_OBJC_BRIDGE_GET(clientIdentity);

0 commit comments

Comments
 (0)