summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-03-21 11:24:30 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-03-21 11:24:30 +0000
commit3549d8275503943dcfaf30634a6ddf9b3e966bf1 (patch)
tree82d7f9943c1ee1f6d81a5fa17b972d9e85966bfd /plugins/MirOTR/src
parent582059e57583e0f2b4055b9d22f961dbff5cc221 (diff)
avoiding module duplicate during linking
git-svn-id: http://svn.miranda-ng.org/main/trunk@12461 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r--plugins/MirOTR/src/otr.cpp88
1 files changed, 42 insertions, 46 deletions
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index de3f7e42ed..92608222b5 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -344,52 +344,48 @@ gcry_error_t otrl_privkey_write_FILEp(OtrlUserState us, FILE *privf);
/* Generate a private DSA key for a given account, storing it into a
* file on disk, and loading it into the given OtrlUserState. Overwrite any
* previously generated keys for that account in that OtrlUserState. */
- gcry_error_t otrl_privkey_write(OtrlUserState us, const char *filename)
+gcry_error_t otrl_privkey_write(OtrlUserState us, const char *filename)
+{
+ gcry_error_t err;
+ FILE *privf;
+#ifndef WIN32
+ mode_t oldmask = umask(077);
+#endif
+ privf = fopen(filename, "w+b");
+ if (!privf) {
+#ifndef WIN32
+ umask(oldmask);
+#endif
+ err = gcry_error_from_errno(errno);
+ return err;
+ }
+
+ err = otrl_privkey_write_FILEp(us, privf);
+
+ fclose(privf);
+#ifndef WIN32
+ umask(oldmask);
+#endif
+ return err;
+}
+
+ /* Just store the private keys of an OtrlUserState.
+ * The FILE* must be open for reading and writing. */
+ gcry_error_t otrl_privkey_write_FILEp(OtrlUserState us, FILE *privf)
{
- gcry_error_t err;
- FILE *privf;
- #ifndef WIN32
- mode_t oldmask;
- #endif
-
- #ifndef WIN32
- oldmask = umask(077);
- #endif
- privf = fopen(filename, "w+b");
- if (!privf) {
- #ifndef WIN32
- umask(oldmask);
- #endif
- err = gcry_error_from_errno(errno);
- return err;
- }
-
- err = otrl_privkey_write_FILEp(us, privf);
-
- fclose(privf);
- #ifndef WIN32
- umask(oldmask);
- #endif
- return err;
+ OtrlPrivKey *p;
+
+ if (!privf) return gcry_error(GPG_ERR_NO_ERROR);
+
+
+
+ /* Output the other keys we know */
+ fprintf(privf, "(privkeys\n");
+ for (p = us->privkey_root; p; p = p->next) {
+ otrl_account_write(privf, p->accountname, p->protocol, p->privkey);
}
+ if (fprintf(privf, ")\n") < 0)
+ return gcry_error_from_errno(errno);
+ return gcry_error(GPG_ERR_NO_ERROR);
-/* Just store the private keys of an OtrlUserState.
- * The FILE* must be open for reading and writing. */
- gcry_error_t otrl_privkey_write_FILEp(OtrlUserState us, FILE *privf)
- {
- OtrlPrivKey *p;
-
- if (!privf) return gcry_error(GPG_ERR_NO_ERROR);
-
-
-
- /* Output the other keys we know */
- fprintf(privf, "(privkeys\n");
- for (p=us->privkey_root; p; p=p->next) {
- otrl_account_write(privf, p->accountname, p->protocol, p->privkey);
- }
- if ( fprintf(privf, ")\n") < 0 )
- return gcry_error_from_errno(errno);
- return gcry_error(GPG_ERR_NO_ERROR);
-
-} \ No newline at end of file
+ } \ No newline at end of file